Advanced Algorithms 南京大学 尹一通
LP-based Algorithms LP rounding: Relax the integer program to LP; round the optimal LP solution to a nearby feasible integral solution. The primal-dual schema: Find a pair of solutions to the primal and dual programs which are close to each other.
Vertex Cover Instance: An undirected graph G(V,E) Find the smallest C V that every edge has at least one endpoint in C. e 1 v1 e 2 e 1 e 3 v3 v2 e 2 e 3 v1 v2 e 5 e 6 e 4 v4 incidence graph e 4 e 5 e 6 v3 v4 instance of set cover with frequency =2
Instance: An undirected graph G(V,E) Find the smallest C V that every edge has at least one endpoint in C. Find a maximal matching M; return the set C ={v: uv M} of matched vertices; maximality C is vertex cover e 1 matching M OPTVC (weak duality) e 2 e 3 e 4 v1 v2 v3 C 2 M 2OPT e 5 e 6 v4
Duality e 1 vertex cover: matching: e 2 e 3 e 4 e 5 e 6 constraints v e xv 1 variables ye {0,1} v1 v2 v3 v4 variables xv {0,1} constraints e v ye 1
Duality Instance: graph G(V,E) primal: dual: minimize subject to v2v v2e maximize subject to x v x v 1, x v 2 {0, 1}, e2e e3v y e y v apple 1, y e 2 {0, 1}, 8e 2 E 8v 2 V 8v 2 V 8e 2 E vertex covers matchings
Duality for LP-Relaxation Instance: graph G(V,E) primal: dual: minimize subject to v2v v2e maximize subject to e2e e3v x v x v 1, x v 0, y e y v apple 1, y e 0, 8e 2 E 8v 2 V 8v 2 V 8e 2 E
Estimate the Optima minimize subject to 7x 1 + x 2 + 5x 3 x 1 x 2 + 3x 3 10 + 5x 1 + 2x 2 x 3 6 + = x 1,x 2,x 3 0 16 16 OPT any feasible solution
Estimate the Optima minimize 7x 1 + x 2 + 5x 3 subject to y 1 x 1 x 2 + 3x 3 10 y 1 + + y 2 5x 1 + 2x 2 x 3 6 y 2 x 1,x 2,x 3 0 10y 1 +6y 2 OPT for any y 1 + 5y 2 7 y 1 + 2y 2 1 3y 1 y 2 5 y 1,y 2 0
Primal-Dual Primal min 7x 1 + x 2 + 5x 3 x 1 x 2 + 3x 3 10 5x 1 + 2x 2 x 3 6 x 1,x 2,x 3 0 Dual max 10y 1 +6y 2 dual feasible y 1 + 5y 2 7 primal OPT y 1 + 2y 2 1 3y 1 y 2 5 LP NP conp y 1,y 2 0
Surviving Problem price vitamin 1 c1 c2 cn a11 a12 a1n healthy b1 vitamin m am1 am2 amn bm solution: x1 x2 xn minimize the total price while keeping healthy
Surviving Problem min c T x Ax b x 0 price vitamin 1 c1 c2 cn a11 a12 a1n healthy b1 vitamin m am1 am2 amn bm solution: x1 x2 xn minimize the total price while keeping healthy
LP Duality Primal: min c T x Dual: max b T y Ax b y T A c T x 0 y 0 dual solution: price c1 c2 cn healthy y1 vitamin 1 a11 a12 a1n b1 ym vitamin m am1 am2 amn bm m types of vitamin pills, design a pricing system competitive to n natural foods, max the total price
LP Duality Primal: min c T x Dual: max b T y Ax b y T A c T x 0 y 0 Monogamy: dual(dual(lp)) = LP Weak Duality: feasible primal solution x and dual solution y y T b y T A x c T x
LP Duality Primal: min c T x Dual: max b T y Ax b y T A c T x 0 y 0 Weak Duality Theorem: feasible primal solution x and dual solution y y T b c T x
LP Duality Primal: min c T x Dual: max b T y Ax b y T A c T x 0 y 0 Strong Duality Theorem: Primal LP has finite optimal solution x * iff dual LP has finite optimal solution y *. y *T b = c T x *
Primal: min c T x Dual: max b T y Ax b x 0 y T A c T y 0 feasible primal solution x and dual solution y y T b y T A x c T x Strong Duality Theorem x and y are both optimal iff y T b = y T A x = c T x i: either Ai x = bi or yi = 0 j: either y T A j = cj or xj = 0 0 1 m m n b i y i = @ a ij x j A y i i=1 n c j x j = i=1 n j=1 j=1 j=1 i=1! m a ij y i x j
Complementary Slackness Primal: min c T x Ax b x 0 Dual: max b T y y T A c T y 0 Complementary Slackness Conditions: feasible primal solution x and dual solution y x and y are both optimal iff i: either Ai x = bi or yi = 0 j: either y T A j = cj or xj = 0
Relaxed Complementary Slackness Primal: min c T x Dual: max b T y Ax b x 0 y T A c T y 0 feasible primal solution x and dual solution y for α, β 1: i: either Ai x α bi or yi = 0 j: either y T A j cj/β or xj = 0 c T x αβ b T y αβ OPTLP n c j x j apple j=1 n j=1! m a ij y i x j = i=1 0 1 m n @ a ij x i A y j i=1 j=1 apple m i=1 b i y i
Primal-Dual Schema Primal IP: min c T x Dual LP-relax: max b T y Ax b x Z 0 y T A c T y 0 Find a primal integral solution x and a dual solution y for α, β 1: i: either Ai x α bi or yi = 0 j: either y T A j cj/β or xj = 0 c T x αβ b T y αβ OPTLP αβ OPTIP
e 1 e 2 e 3 e 4 e 5 e 6 vertex cover: constraints v e xv 1 matching: variables ye {0,1} v1 v2 v3 v4 variables xv {0,1} constraints e v ye 1 primal: dual-relax: min min v2v x v x v 1, 8e 2 E v2e x v 2 {0, 1}, e2e y e y e apple 1, e3v 8v 2 V 8v 2 V y e 0, 8e 2 E feasible (x, y) such that: e: ye > 0 v e xv α v: xv = 1 e v ye = 1
primal: min v2v x v x v 1, 8e 2 E v2e x v 2 {0, 1}, 8v 2 V dual-relax: min e2e y e y e apple 1, e3v 8v 2 V y e 0, 8e 2 E event: v is tight (saturated) e v ye = 1 Initially x = 0, y = 0; while E to 1 pick an e E and raise ye until some v goes tight; set xv = 1 for those tight v and delete all e v from E; v e o every deleted e is incident to a v that xv = 1 e E: v e x v 1 all edges are eventually deleted x is feasible relaxed complementary slackness: e: either v e xv 2 or ye = 0 v: either e v ye = 1 or xv = 0 v2v x v apple 2 OPT
Initially x = 0, y = 0; while E to 1 pick an e E and raise ye until some v goes tight; set xv = 1 for those tight v and delete all e v from E; v e Find a maximal matching; return the set of matched vertices; the returned set is a vertex cover SOL 2 OPT
The Primal-Dual Schema Write down an LP-relaxation and its dual. min c T x Ax b x Z 0 Start with a primal infeasible solution x and a dual feasible solution y (usually x=0, y=0). Raise x and y until x is feasible: raise y until some dual constraints gets tight y T A j = cj ; raise xj (integrally) corresponding to the tight dual constraints. Show the complementary slackness conditions: i: either A i x α b i or y i = 0 j: either y T A j cj/β or xj = 0 max b T y y T A c T y 0 c T x αβ b T y αβ OPT
Integrality Gap LP relaxation of vertex cover : given G(V,E), minimize v V xv subject to v e xv 1, e E xv {0, 1}, v V xv [0, 1], Integrality gap = sup I OPT(I) OPT LP (I) For the LP relaxation of vertex cover: integrality gap = 2
Facility Location hospitals in Nanjing
Facility Location facilities: f i c ij clients: j i Instance: set F of facilities; set C of clients; Find a subset I F of opening facilities and a way φ: C I of connecting all clients to them such that the total cost facility opening costs f: F [0, ); connection costs c: F C [0, ); j2c c (j),j + i2i f i is minimized. uncapacitated facility location; NP-hard; AP(Approximation Preserving)-reduction from Set Cover; [Dinur, Steuer 2014] no poly-time (1-o(1))ln n-approx. algorithm unless NP = P.
Metric Facility Location facilities: clients: j i f i d ij Instance: set F of facilities; set C of clients; facility opening costs f: F [0, ); connection metric d: F C [0, ); Find a subset I F of opening facilities and a way φ: C I of connecting all clients to them such that the total cost triangle inequality: j2c d (j),j + i2i f i is minimized. 8i 1,i 2 2 F, 8j 1,j 2 2 C i1 i2 d i1 j 1 + d i2 j 1 + d i2 j 2 d i1 j 2 j1 j2
Instance: set F of facilities; set C of clients; facility opening costs f: F [0, ); connection metric d: F C [0, ); Find φ: C I F to minimize facilities: LP-relaxation: min x ij,y i 0, d ij y i 2 {0, 1} i f i j2c d (j),j + i2i i2f,j2c d ij x ij + i2f i2f x ij 2 {0, 1} clients: j y i x ij, x ij,y i 2 {0, 1}, indicates i I f i y i x ij 1, 8j 2 C f i indicates i = φ(j) 8i 2 F, j 2 C 8i 2 F, j 2 C
facilities: d ij clients: j i ij j f i Primal: min d ij x ij + f i y i i2f,j2c i2f y i x ij 0, 8i 2 F, j 2 C x ij 1, 8j 2 C i2f x ij,y i 2 {0, 1}, 8i 2 F, j 2 C Dual-relax: max j2c j j ij apple d ij, ij apple f i, j2c 8i 2 F, j 2 C 8i 2 F j, ij 0, 8i 2 F, j 2 C α j : amount of value paid by client j to all facilities βij αj - dij : payment to facility i by client j (after deduction) complimentary slackness conditions: (if ideally held) x ij =1 α j - β ij = d ij ; yi =1 j C βij = fi ; α j > 0 i F x ij = 1 ; βij > 0 yi = xij ;
min d ij x ij + f i y i i2f,j2c i2f y i x ij 0, 8i 2 F, j 2 C x ij 1, 8j 2 C i2f x ij,y i 2 {0, 1}, facilities: 8i 2 F, j 2 C i f i d ij ij j max clients: j j2c j j ij apple d ij, ij apple f i, j2c 8i 2 F, j 2 C 8i 2 F j, ij 0, 8i 2 F, j 2 C Initially α = 0, β = 0, no facility is open, no client is served; raise αj for all client j simultaneously at a uniform continuous rate: upon αj = dij for a closed facility i: edge (i,j) is paid; fix βij = αj - dij as αj being raised; upon j C βij = fi : tentatively open facility i; connect all clients j with paid (i,j) to facility i and stop raising αj; upon αj = dij for a tentatively open facility i: connect client j to facility i and stop raising αj;
facilities: i f i d ij ij j clients: j Initially α = 0, β = 0, no facility is open, no client is served; raise αj for all client j simultaneously at a uniform continuous rate: upon αj = dij for a closed facility i: edge (i,j) is paid; fix βij = αj - dij as αj being raised; upon j C βij = fi : tentatively open facility i; connect all clients j with paid (i,j) to facility i and stop raising αj; upon αj = dij for a tentatively open facility i: connect client j to facility i and stop raising αj; The events that occur at the same time are processed in arbitrary order. Fully paid facilities are tentatively open: j C βij = fi Fully paid edges to tentatively opening facilities are connected: αj - βij = dij Eventually all clients connect to tentatively opening facilities. A client may connect to more than one facilities!
Phase I: Initially α = 0, β = 0, no facility is open, no client is served; raise αj for all client j simultaneously at a uniform continuous rate: upon αj = dij for a closed facility i: edge (i,j) is paid; fix βij = αj - dij as αj being raised; upon j C βij = fi : tentatively open facility i; connect all clients j with paid (i,j) to facility i and stop raising αj; upon αj = dij for a tentatively open facility i: connect client j to facility i and stop raising αj; facilities: i f i d ij ij Phase II: construct graph G(V,E) where V={tentatively open facilities} and (i 1, i 2 ) E if facilities i 1, i 2 are connected to same client j in Phase I; find a maximal independent set I of G and permanently open facilities in I; connect facilities in I to the directly connected clients in Phase I; for every unconnected client (the indirectly connected clients): connect it to the nearest open facility; j clients: j i1 j1 i2 j2
Phase I: Initially α = 0, β = 0, no facility is open, no client is served; raise αj for all client j simultaneously at a uniform continuous rate: upon αj = dij for a closed facility i: edge (i,j) is paid; fix βij = αj - dij as αj being raised; upon j C βij = fi : tentatively open facility i; connect all clients j with paid (i,j) to facility i and stop raising αj; upon αj = dij for a tentatively open facility i: connect client j to facility i and stop raising αj; Phase II: construct graph G(V,E) where V={tentatively open facilities} and (i 1, i 2 ) E if facilities i 1, i 2 are connected to same client j in Phase I; find a maximal independent set I of G and permanently open facilities in I; connect facilities in I to the directly connected clients in Phase I; for every unconnected client (the indirectly connected clients): connect it to the nearest open facility; i1 j1 i2 j2 I is independent set Every client is connected to exact one open facilities. (feasible)
facilities: i f i d ij ij j clients: j Primal: min d ij x ij + f i y i i2f,j2c i2f y i x ij 0, 8i 2 F, j 2 C x ij 1, 8j 2 C i2f x ij,y i 2 {0, 1}, 8i 2 F, j 2 C Dual-relax: max j2c j j ij apple d ij, ij apple f i, j2c 8i 2 F, j 2 C 8i 2 F j, ij 0, 8i 2 F, j 2 C α j : amount of value paid by client j to all facilities βij αj - dij : payment to facility i by client j (after deduction) complimentary slackness conditions: (if ideally held) x ij =1 α j - β ij = d ij ; yi =1 j C βij = fi ; α j > 0 i F x ij = 1 ; βij > 0 yi = xij ;
Phase I: Initially α = 0, β = 0, no facility is open, no client is served; raise n αj for all client j simultaneously at a uniform continuous rate: upon αj = dij for a closed facility i: edge (i,j) is paid; fix βij = αj - dij as αj being raised; upon j C βij = fi : tentatively open facility i; connect all clients j with paid (i,j) to facility i and stop raising αj; upon αj = dij for a tentatively open facility i: connect client j to facility i and stop raising αj; Phase II: construct graph G(V,E) where V={tentatively open facilities} and (i 1, i 2 ) E if facilities i 1, i 2 are connected to same client j in Phase I; find a maximal independent set I of G and permanently open facilities in I; connect facilities in I to the directly connected clients in Phase I; for every unconnected client (the indirectly connected clients): connect it to the nearest open facility; SOL= apple f i + i2i j:directly connected (j) = ( j:directly connected j d (j)j + triangle inequality apple 3 + maximality of I j:indirectly connected i that βij = αj - dij if j is directly connected nearest facility in I j:indirectly connected d (j)j j if j is indirectly connected i1 j1 i2 j2 apple 3 j2c j 3 OPT
Phase I: Initially α = 0, β = 0, no facility is open, no client is served; raise αj for all client j simultaneously at a uniform continuous rate: upon αj = dij for a closed facility i: edge (i,j) is paid; fix βij = αj - dij as αj being raised; upon j C βij = fi : tentatively open facility i; connect all clients j with paid (i,j) to facility i and stop raising αj; upon αj = dij for a tentatively open facility i: connect client j to facility i and stop raising αj; Phase II: construct graph G(V,E) where V={tentatively open facilities} and (i 1, i 2 ) E if facilities i 1, i 2 are connected to same client j in Phase I; find a maximal independent set I of G and permanently open facilities in I; connect facilities in I to the directly connected clients in Phase I; for every unconnected client (the indirectly connected clients): connect it to the nearest open facility; SOL 3 OPT i1 j1 i2 j2 can be implemented discretely: in O(m log m) time, m= F C sort all edges (i,j) F C by non-decreasing dij dynamically maintain the time of next event by heap
Instance: set F of facilities; set C of clients; facility opening costs f: F [0, ); connection metric d: F C [0, ); Find φ: C I F to minimize j2c d (j),j + i2i f i min i2f,j2c d ij x ij + i2f x ij,y i 2 {0, 1}, f i y i y i x ij 0, x ij 1, 8j 2 C i2f facilities: i f i d ij clients: j 8i 2 F, j 2 C 8i 2 F, j 2 C Integrality gap = 3 no poly-time <1.463-approx. algorithm unless NP=P [Li 2011] 1.488-approx. algorithm