Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik Combinatorial Optimization (MA 4502) Dr. Michael Ritter Problem Sheet 1 Homework Problems Exercise 1.1 Let G = (V, E, d) be a digraph with arc lengths d : E N and let s, t V be two distinct nodes in the digraph. Devise an integer linear program that models the problem of finding a shortest directed s-t path in G. What is the encoding length of your ILP? Answer to Exercise 1.1 Let A be the node-arc incidence matrix of G, i. e. +1, if e δ + (v) (outgoing arc), a v,e = 1, if e δ (v) (incoming arc), 0, otherwise. We use variables x e 0, 1 for all e E with the interpretation x e = 1, e is contained in a shortest s-t path, 0, otherwise. The ILP is basically a flow formulation: We are looking for a flow of value 1 from the source s to the sink t that incurs minimal cost: min e E d e x e Ax = 0 + 1 s 1 t x 0, 1 E Or directly, without using the incidence matrix A: min e E d e x e e δ (v) e δ + (s) x e x e = 1 x 0, 1 E e δ + (v) = 0 for all v V \ s, t The inflow constraints for t do not need to be included, because with the outflow constraints for s and the flow balance constraints for all other nodes they are already implied. For encoding the problem we need to represent the graph G, the arc lengths d and the two nodes s,t. For the graph, we can choose among a variety of representations, e. g. we could use the incidence Page 1 of 5
matrix as defined above. Each entry of this n m matrix is in 1, 0, 1, so we need Θ(nm) bits to encode it. The incidence matrix also defines an enumeration of both nodes and edges, so s and t can each be represented by a number in [n], accounting for an additional 2 size(n) bits. For the arc lengths we use a vector of length m that stores the arc length for each arc, so we need e E size(d e) bits to encode the lengths. Tutorial Problems Exercise 1.2 Find an ILP formulation for the Bin Packing Problem: Input: n N, weights w N n, a bin capacity C N Task: find a partition B 1 B 2... B k = [n] into a minimal number k of subsets of [n] such that w(b i ) C for all i [k] Answer to Exercise 1.2 We first need an upper bound for the number of bins that might be used. We may assume that w i C, otherwise the problem would be infeasible, thus the number of items n is a simple upper bound on the number of bins necessary. We use two classes of binary variables: x ij = 1, if item i is assigned to bin j 0, otherwise y j = 1, if bin j is used 0, otherwise The problem can then be expressed through the following integer linear program: min y j j=1 w i x ij Cy j j = 1,..., n i=1 x ij = 1 i = 1,..., n j=1 x 0, 1 n n y 0, 1 n Exercise 1.3 a) Imagine you had an algorithm to determine a feasible point of a polyhedron x R n : Ax b for arbitrary matrices A R m n and vectors b R m (if the inequalities are infeasible, the algorithm will detect and report this). How can you use that algorithm to determine the solution to a linear optimization problem? b) Consider again the situation of a), but now with an oracle that only reports whether the given system of linear inequalities is feasible or not (instead of returning a feasible point). Use that oracle to design an algorithm that solves a linear optimization problem. Can you do this using a polynomially bounded number of calls to the oracle? Page 2 of 5
Answer to Exercise 1.3 a) The main idea is to employ duality theory: A primal feasible solutions is optimal if and only if there is a corresponding dual feasible solution with the same objective value. Consider the problem of finding an optimal solution of the linear optimization problem max c T x : Ax b. (1) The dual optimization problem is min b T y : A T y = c, y 0. (2) According to duality theory, x and y are optimal for the primal and the dual problem, if and only if they are both feasible for their respective problems and the objective values agree. Thus, we need to find a feasible point (x, y) of the polyhedron P = (x, y) R n+m : Ax b, A T y = c, y 0, b T y = c T x This polyhedron can easily be transformed into the desired form, and any feasible point will constitute an optimal solution to the original LP. If the oracle returns a feasible solution (x, y ), then b T y c T x Thus, x is an optimal solution for (1). If the oracle returns that P does not have a feasible point, then either (1) is infeasible or its dual is infeasible, which means that (1) is unbounded. Polynomial size: Clear. b) Using the results from the first part of this proble, it suffices to construct an algorithm that given a feasible system of inequalities constructs a feasible point. Let us first assume that P has a vertex v. Then the active inequalities in v form a system of linear equalities A I x = b I such that v is the unique solution, where A I = (a i, i I) T denotes the submatrix of rows I of A. The idea is now to find such a set I that defines a feasible point. Then, we can solve this system of linear equalities easily to obtain the feasible point. The following algorithm accomplishes this. i) set C 0 = A, d 0 = b ii) for i 0,..., m 1 do 1) call oracle whether there is a feasible point for C i x d i, a T i x b i ( ) ( ) C 2) if answer = YES, then C i+1 i d =, d i+1 i = b i 3) else C i+1 = C i, d i+1 = d i end if iii) end for iv) if rank(c m ) < n, then a T i 1) fill up C m with arbitrary linearly independent rows to achieve full rank 2) fill up d m with zeros, such that the number of rows is equal to C m v) end if Page 3 of 5
vi) solve C m x = d m vii) return solution x Obviously, the oracle is called only polynomially often and each time the input into the oracle is polynomial in the input size. Exercise 1.4 In this exercise we will establish a connection between three different ways to state a problem. As an example, consider the traveling salesman problem: Problem 1: TSP optimization problem Instance: n, m N, a graph G = (V, E) with n nodes and m edges, a weight vector c N m Task: Determine if a Hamilton circuit exists in G and if so, return one with minimum total weight. Problem 2: TSP function problem Instance: n, m N, a graph G = (V, E) with n nodes and m edges, a weight vector c N m Task: Return the length of a Hamilton circuit with minimum total weight in G or, if no Hamilton circuit exists. Problem 3: TSP decision problem Instance: n, m N, a graph G = (V, E) with n nodes and m edges, a weight vector c N m, K N Question: Does a Hamilton circuit of total weight at most K exist in G? Obviously, if we have an algorithm that solves the optimization problem, the other two version can also be solved. In this exercise, we will show that the reverse is also (essentially) true. a) Imagine you had an algorithm that could solve the decision problem for TSP which may be used as a black box (more formally called an oracle). Design an algorithm that uses the decision oracle to solve the function problem. Can you find an algorithm that calls the oracle only polynomially often and with polynomially bounded inputs (such an algorithm would be called oracle-polynomial)? (In particular, you may not just call the decision oracle K times, since K is exponential in the input size of the instance remember that K is part of the input.) b) Imagine you had an algorithm that could solve the function problem for TSP. Design an algorithm that uses this function oracle to solve the optimization problem. Again, try to find an oracle-polynomial algorithm! Answer to Exercise 1.4 a) i) TSP problem, oracle for decision problem. Aim: Solve function problem 1) set M = (n + 1)c max 2) call oracle with G and M 3) if answer of oracle is NO then return end if 4) m = 0 5) µ = m+m 2 6) while ( m M ) do Page 4 of 5
A. call oracle with G and µ B. if answer = YES, then M = µ C. else m = µ + 1 end if D. µ = m+m 2 7) end while 8) return M Input size to oracle is polynomial: G has obiously polynomial size, M = n c max. Hence, M has also polynomial size. Number of calls to the oracle is O(log(M)), since the size of intervall [m, M] decreases by a factor of at least 2 and m, M N. Besides, this is polynomial in the input size and it bounds the running time of the algorithm, assuming that a call to the oracle has constant cost. ii) Oracle function for TSP. Aim: Algorithm for optimization problem 1) apply oracle to obtain an optimal value m for G and c 2) if m = then return " Graph is not Hamiltonian" end if 3) Ẽ = E 4) forall f E do A. set c (e) = c(e) e f and c (f) = m + 1 B. apply oracle to V, Ẽ) and c to obtain m C. if m = m then remove f from Ẽ end if 5) end for 6) return Ẽ. Polynomial size of each input into the oracle is clear. Number of oracle calls: 1 + m, which is also polynomial. If an oracle call has constant cost, then the algorithm runs in polynomial time. Page 5 of 5