Mastermath ad LNMB Course: Discrete Optimizatio Solutios for the Exam 9 Jauary 2012 Utrecht Uiversity, Educatorium, 15:15 18:15 The examiatio lasts 3 hours. Gradig will be doe before Jauary 23, 2012. Studets iterested i checkig their results ca make a appoitmet by e-mail (g.schaefer@cwi.l). The examiatio cosists of six problems. The maximum umber of poits to be gaied o the differet parts are displayed i the followig table: 1(a) (j) 2 3(a) 3(b) 3(c) 4 5 6(a) 6(b) 6(c) 20 (2 each) 10 5 5 5 15 15 5 10 10 100 The grade for the exam is obtaied by dividig the total umber of poits by 10. This implies that 55 poits are eeded to pass. Durig the examiatio oly the Lecture Notes of the course without ay additioal leaflets are allowed to be o your desk ad all electroic equipmet must be switched off. Please be short, clear ad precise i your aswers. If you use results from the Lecture Notes, please provide the respective refereces. Please had i your aswers together with the exam sheet. Wishig you a Happy New Year 2012 ad Good Luck! Discrete Optimizatio: Exam 9 Jauary 2012 Page 1/8
Problem 1 (20 poits (2 poits each)). State for each of the claims below whether it is true of false. Note: You eed ot to justify or proof your aswers here. (a) = Ω(). (b) Let G = (V,E) be a bipartite graph ad defie I = {M E M is a matchig of G}. The (E,I) is a matroid. (c) Give a spaig tree T of a graph G = (V,E), let deg T (u) refer to the umber of edges i T that are icidet to u V. The u V deg T (u) = 2 1. (d) A graph is bipartite if ad oly if it does ot cotai a odd legth cycle. (e) Give a directed graph G = (V,E) with edge costs c : E R, oe ca determie i polyomial time whether G cotais a cycle of egative cost. (f) If Π 1 P ad Π 2 Π 1, the Π 2 P. (g) If Π 1 is NP-complete ad Π 1 Π 2, the Π 2 is NP-complete. (h) If there exists a NP-complete problem Π such that Π P, the P = NP. (i) If there is a pseudo-polyomial time algorithm for a optimizatio problem Π, the Π P. (j) There exists a 3 2-approximatio algorithm for TSP. Solutio: (a) false (b) false (c) false (d) true (e) true (f) true (g) false (h) true (i) false (j) false (uless P = NP) Problem 2 (10 poits). Let M 1 = (S,I 1 ) ad M 2 = (S,I 2 ) be two matroids over the same groud set S. The itersectio M 1 M 2 of M 1 ad M 2 is defied as the idepedet set system (S,I 1 I 2 ). Let G = (L R,E) be a bipartite graph ad defie I = {M E M is a matchig of G}. Show that the idepedet set system (E, I) is the itersectio of two matroids. (Hit: A L-sided matchig of G is a subset M E such that each ode u L has at most oe edge i M icidet to it.) Discrete Optimizatio: Exam 9 Jauary 2012 Page 2/8
Solutio: We first show that the pair (E,I L ) with I L = {M E M is a L-sided matchig of G} costitutes a matroid. First, ote that /0 I L. Secod, let M I L ad M M. Clearly, because M is a L-sided matchig, every ode u L has at most oe edge i M icidet to it. Thus M I L. Fially, let M,M I L ad assume M < M. The there is a ode u L that is matched i M ad umatched i M. By addig the matchig edge e M icidet to u to M we obtai a ew L-sided matchig M + e I L. Thus, (E,I L ) is a matroid by Defiitio 3.2 of the Lecture Notes. We proceed exactly the same way to show that (E,I R ) with I L = {M E M is a R-sided matchig of G} is a matroid. (A R-sided matchig of G is a subset M E such that each ode u R has at most oe edge i M icidet to it.) Fially, we prove that M E is a matchig of G if ad oly if M I L I R. Clearly, if M is a matchig the M is both a L-sided ad a R-sided matchig by defiitio. To show the coverse, suppose for the sake of a cotradictio that M I L I R ad M is ot a matchig. Because M is ot a matchig, there must two edges e 1 ad e 2 that share a commo edpoit, say u. Suppose u L (the case u R follows aalogously). But the two edges are icidet to u ad M is thus ot a left-sided matchig, which is a cotradictio to the assumptio that M I L. Problem 3 (5+5+5 poits). I the miimum-weight edge cover problem we are give a udirected graph G = (V,E) with edge weights w : E R +. A edge cover E E of G is a subset of the edges such that each ode u V is covered by at least oe edge i E, i.e., for every ode u V there is a edge (u,v) E. The goal is to compute a edge cover E of miimum total weight w(e ) = e E w(e). (a) Formulate the miimum-weight edge cover problem as a iteger liear program ad derive the respective LP relaxatio. (b) Show that the set of feasible solutios of this LP is a itegral polytope if G is bipartite. (c) Give a example that shows that a optimal solutio to this LP might be o-itegral if G is ot bipartite. Solutio: (a) The iteger programmig formulatio of the miimum-weight edge cover problem is as follows: We have a idicator variable x e {0,1} for every edge e E with x e = 1 Discrete Optimizatio: Exam 9 Jauary 2012 Page 3/8
iff e belogs to the edge cover E. miimize subject to w(e)x e e E x e 1 e=(u,v) E x e {0,1} u V e E (1) The LP relaxatio is miimize subject to w(e)x e e E x e 1 e=(u,v) E x e 0 u V e E (2) Note that the costraits x e 1 e E are redudat because of the miimizatio objective. (b) Cosider LP (2). We ca rewrite this LP as follows: miw T x s.t. Ax 1, x 0 where A is the icidece matrix of a udirected bipartite graph. By Corollary 8.1 of the Lecture Notes, A is totally uimodular. As a cosequece, A is also totally uimodular (multiplyig by 1 does ot chage the absolute value of the determiat). Also, 1 is itegral ad thus the polytope P = {x Ax 1, x 0} is itegral by Theorem 8.8 of the Lecture Notes. (c) Cosider a cycle of legth 3 with every edge havig uit weight. A optimal solutio to LP (2) is x e = 1 2 for every edge e E with total weight 2 3. This solutio is ot itegral. Problem 4 (15 poits). Cosider the followig miimum shortest-path-cut problem: We are give a directed graph G = (V,E) with edge costs c : E R +, a source ode s V ad a target ode t V. The goal is to fid a subset C E of miimum cardiality such that every shortest s,t-path P (with respect to c) is cut by C, i.e., P C /0. Derive a algorithm that solves this problem, prove its correctess ad aalyze its ruig time. Solutio: The algorithm is as follows: First ote that the algorithm termiates. The correctess of the algorithm follows from the followig lemma: Lemma 1. P is a shortest s,t-path i G if ad oly if P is a s,t-path i G. Proof. First ote that the distace fuctio δ is well defied because edge costs are oegative. Suppose P is a shortest s,t-path i G. The all edges of P must be tight Discrete Optimizatio: Exam 9 Jauary 2012 Page 4/8
Iput: A directed graph G = (V,E) with edge costs c : E R +, a source ode s V ad a target ode t V. Output: Subset C E of miimum size that cuts every shortest s,t-path. 1 Solve the SSSP problem with s as source ode to determie distaces δ(u) for every u V. 2 Costruct the subgraph of G that cotais all tight edges with respect to δ. Remove from this graph all edges that do ot lie o a s,t-path. Let the resultig graph be G = (V,E ). 3 Compute a miimum capacity s,t-cut (X, X) (with respect to uit capacities) of G ad let C be the set of directed edges from X to X. 4 Output C. (Lemma 4.4. of the Lecture Notes) ad thus P is part of G. Next cosider a arbitrary s,t-path P = s = v 1,v 2,...,v k = t i G. The cost of this path is c(p) = Thus P is a shortest s,t-path. k 1 k 1 c(v i,v i+1 ) = δ(v i+1 ) δ(v i ) = δ(t) δ(s) = δ(t). I light of Lemma 1, the goal ow is to determie a subset of edges C E of miimum cardiality such that after removig C form G, s ad t are discoected i G. Let (X, X) be a miimum capacity s,t-cut of G, where each edge e E has uit capacity. Defie C = {(u,v) E u X, v X}. By Theorem 5.3 of the Lecture Notes, C cuts every s,t-path i G ad has miimum size. We ext aalyze the ruig time of the algorithm: We ca use Dijkstra s algorithm i Step 1 because edge costs are o-egative. This takes O(m + log) time. Step 2 requires that we check for every edge e E whether e is tight. This takes time O(m). We ca determie (i) all odes that are reachable from s ad (ii) all odes from which t is reachable i time O(+m) by ruig oe depth-first search from s ad oe depth-first search from t (o the graph with all edge directios reversed). Step 2 thus takes O(+m) time i total. Computig a miimum capacity s,t-cut i Step 3 ca be doe by a max-flow computatio (see Theorem 5.3 of the Lecture Notes) which takes time O(m 2 ) if we use the Edmods-Karp algorithm. Idetifyig the edges i the cut requires O( + m) time. The overall ruig time of the algorithm is domiated by the max-flow computatio ad is thus O(m 2 ). Problem 5 (15 poits). The decisio variat of the kapsack problem is as follows: We are give a set N = {1,...,} of items with each item i N havig a profit p i Z + ad a weight w i Z +, a kapsack capacity B Z + ad a parameter K Z +. The goal is to determie whether there exists a subset X N such that w(x) = i X w i B ad p(x) = i X p i K. Prove that the kapsack problem is NP-complete. (Hit: Use that the followig subset Discrete Optimizatio: Exam 9 Jauary 2012 Page 5/8
sum problem is NP-complete: Give o-egative itegers s 1,...,s ad a parameter L, determie whether there is a subset of these umbers whose total sum is L.) Solutio: We first argue that kapsack NP. A certificate of a yes-istace is a subset X of N with w(x) B ad p(x) K. Both coditios ca be checked i liear time (i ). I order to prove NP-completeess, we show that subset sum kapsack. The claim the follows because the subset sum problem is NP-complete. Let I = (s 1,...,s,L) be a istace of the subset sum problem. Defie a istace I of the kapsack problem as follows: N = {1,...,} ad for every i N: p i = w i = s i. Moreover, let B = K = L. This trasformatio takes liear time (i ). We claim that I is a yes-istace of the subset sum problem iff I is a yes-istace of the kapsack problem. Let S N such that i S s i = L. The the weight ad profit of the correspodig kapsack X = S is w(x) = B ad p(x) = K, respectively. Thus X is a yesistace of the kapsack problem. Let X N be a yes-istace of the kapsack problem. The w(x) B ad p(x) K. Because p i = w i = s i for all items i ad B = K = L, we have w(x) = p(x) = L. Thus, with S = X, i S s i = L ad thus I is a yes-istace of the subset sum problem. Problem 6 (5+10+10 poits). A atural greedy algorithm to compute a solutio for the kapsack problem is as follows: Iput: A set N = {1,...,} of items with a profit p i Z + ad a weight w i Z + for every item i N ad a kapsack capacity B Z +. Output: Subset X N of items. 1 Sort the items by o-icreasig profit per weight ratio ad re-idex the items such that p 1 p 2 p. w 1 w 2 w 2 Let k be the smallest idex such that k+1 w i > B. 3 Output X = {1,...,k}. (a) Give a example that shows that the approximatio ratio of the above algorithm ca be arbitrarily large. (b) Let OPT be the profit of a optimal solutio. Prove that the followig relatio holds: OPT k p i + B k w i p k+1. w k+1 (Hit: Formulate the kapsack problem as a iteger liear program, derive the LP relaxatio ad characterize its optimal solutios.) (c) Obtai a 2-approximatio algorithm for the kapsack problem by adaptig the above algorithm ad show that the approximatio ratio is tight. Discrete Optimizatio: Exam 9 Jauary 2012 Page 6/8
Solutio: (a) Suppose we have two items with p 1 = 2 ad w 1 = 1 ad p 2 = B = w 2. The above greedy algorithm picks item 1 with a total profit of 2. A optimal solutio picks item 2 with total profit B. The approximatio ratio B/2 becomes arbitrarily large as B. (b) The followig is a atural iteger liear programmig formulatio of the kapsack problem: maximize p i x i subject to w i x i B (3) The LP relaxatio of (3) is: x i {0,1} i {1,...,} maximize subject to p i x i w i x i B 0 x i 1 i {1,...,} (4) Note that the costraits x i 1 i {1,...,} are ot redudat here. Let OPT ad OPT LP refer to the total profit of a optimal solutio for (3) ad (4), respectively. Because (4) is the LP relaxatio of (3), we have OPT OPT LP. We claim the followig: Lemma 2. The followig solutio x is a optimal solutio to LP (4): 1 if i {1,...,k} x B i = k w i w k+1 if i = k+ 1 0 otherwise Proof. Clearly, 0 x i 1 for every i N ad the total weight of the solutio x is i N w i x i = B. Thus, x is feasible. Moreover, x is a optimal solutio because the items are chose accordig to o-icreasig profit per weight ratio (this follows from a exchage argumet). We coclude OPT OPT LP = p i + B k w i p k+1. w k+1 (c) We adapt the give algorithm by returig the more profitable set of items amog {1,...,k} ad {k+ 1}. Note that the algorithm outputs a feasible solutio (we assume that w i B for every i N). Moreover, the algorithm has polyomial ruig time: Sortig the items by their profit per weight ratio takes O(log). The idex k i Step 2 ca be determied i time O(). Altogether the algorithm eeds O(log) time. It remais to be show that the algorithm achieves a approximatio ratio of 2: Discrete Optimizatio: Exam 9 Jauary 2012 Page 7/8
The total profit of the solutio X output by the algorithm satisfies: 2p(X) k p i + p k+1 OPT. Here the secod iequality follows from part (b) because OPT p i + B k w i p k+1 w k+1 p i + p k+1. The claim follows. The followig example shows that the approximatio ratio of 2 is tight: Cosider three items with p 1 = 2 ad w 1 = 1 ad p 2 = p 3 = 2 1B = w 2 = w 3. The algorithm selects items 1 ad 2 of total profit 2 1 B+2. A optimal solutio chooses items 2 ad 3 of total profit B. Thus the approximatio ratio for this istace is B/( 1 2 B+2) 2 as B. Discrete Optimizatio: Exam 9 Jauary 2012 Page 8/8