550 likes | 772 Views
Linear Programming and Parameterized Algorithms. Linear Programming. n real- valued variables, x 1 , x 2 , … , x n . Linear objective function . Linear (in) equality constraints . Solvable in polynomial time. Maximize x + y 3x + 2y y – x = 8 0 x,y 10.
E N D
Linear Programming n real-valued variables, x1, x2, … , xn. Linear objectivefunction. Linear (in)equalityconstraints. Solvable in polynomial time. Maximizex + y 3x + 2y y – x = 8 0 x,y 10
Integer Linear Programming n integer-valuedvariables, x1, x2, … , xn. Linear objectivefunction. Linear (in)equalityconstraints. NP-complete. Lingo:Linear Programs (LP’s),Integer Linear Programs (ILP’s) Easy to encode3-SAT (Exercise!)
Vertex Cover In:G, k Question:such that every edge in G has an endpoint in S? Have seen a kernelwithO(k2)vertices, willsee a kernelwith2kvertices.
Vertex Cover (I)LP In:G, k Question: such that every edge in G has an endpoint in S? Minimize Z OPTLP OPT
Nemhauser Trotter Theorem • There is always an optimal solution to Vertex Cover LP that sets variables to . • For anyoptimal –solution there is a matching from the 1-vertices to the0-vertices, saturating the 1-vertices.
Matchings and Hall Sets A matching in a graph is a setofedgesthat do not shareanyendpoints. A matching saturatesa vertexsetSifeveryvertex in S is incident to a matching edge. A vertexsetS is a Hall setif it is independentand |N(S)| < |S|. A Hall setmay never be saturated!
Hall’s Theorem Theorem: A bipartite graph has a matching such that every left hand side vertex is saturated ⇔ there is no Hall set on the left hand side.
Hall’sTheoremExample Matching (so no Hall set) Hall set (so no matching)
Nemhauser Trotter Theorem • There is always an optimal solution to Vertex Cover LP that sets variables to . • For any –solution there is a matching from the 1-vertices to the 0-vertices, saturating the 1-vertices.
Nemhauser Trotter Proof Right + + - - - Left This clearly proves (a), butwhydoes it prove (b)?
Reduction Rule If exists optimal LP solution that sets xv to 1, then exists optimal vertex cover that selects v. • Remove v from G and decreasek by 1. Correctness follows from Nemhauser Trotter Polynomial time by LP solving.
Kernel Suppose reduction rule can not be applied and consider any optimal solution to LP. No vertex is 0(remove isolated vertices) No vertex is 1. All vertices are . OPTLPk. n 2k
Above LP Vertex Cover So far we have only seen the solutionsize, k, as the parameterfor vertex cover. Alternative parameter k – OPTLP Note that can be very small even ifk is big!
Vertex Cover Above LP In:G, k. Question:Does there exist a vertex cover S of size at most k? Parameter: where OPTLPis the value of an optimum LP solution. Now FPT means f()nc time!
Reduction Rule Recall the reductionrules from the kernel for Vertex Cover: • If exists optimal LP solution that sets xv to 1, then exists optimal vertex cover that selects v. • Remove v from G and decrease k by 1. • Removeverticesofdegree0. Now the unique LP optimum sets all vertices to
Reductionaffectsk-OPTLP? Reduction rule: If exists optimal LP solution that sets xv to 1 Remove v and decrease k by 1. OPTLP decreases by exactly 1. Why? Feasible LP Solution to G\u 1 v k-OPTLP is unchanged!
Branching Pick an edge uv. Solve (G\u, k-1) and (G\v, k-1). since otherwise there is an optimal LP solution for G that sets u to 1. Then
Branching - Analysis OPTLP– kdrops by ½ ... in both branches! Total time: 4k-OPTLP nO(1)
Vertex Cover recap Using LP’swecanget • a kernelwith2kvertices, • an algorithmthat runs in time 4k-OPTLPnO(1). Is thisusefulwhencompared to a 1.38kalgorithm?
Almost 2-SAT In:2-SAT formula, integer k Question: Can weremove*k variables from and make it satisfiable? *Remove all clausesthatcontainthe variable
Odd Cycle Transversal (OCT) In:G, k Question: such that G\S is bipartite? Will givealgorithmsfor Almost 2-SAT and OCT, usingFPT-reductions to Vertex Cover above LP!
Odd Cycle Transversal Almost 2-Sat x y x y z z
Consequences 4knO(1) time algorithms for Almost 2-SAT and Odd Cycle Transversal. A ck-OPTLPnO(1)algorithm for Vertex Cover automaticallygivesck-OPTLPnO(1)algorithm for Almost 2-SAT and Odd Cycle Transversal. Canget a 2.32k-OPTLPnO(1)algorithm for Vertex Cover by improvingthebranching.
LP versus ILP Wesaw an applicationofLP’s in parameterizedalgorithms. ILP solving is NP-hard. Uselessfor algorithms? No! Wecanuseparameterizedalgorithms for Integer Linear Programming.
Integer Linear Programming Theorem: k4.5kpoly(L) time algorithm, wherek is thenumberof variables, and L is thenumberof bits encodingtheinstance.
ClosestString Input: nstringss1…sn over an alphabetA, all of same lengthL, and an integerk. Question: Is there a string s suchthat for everyi, d(s, si) k? Parameter: n Note: the parameter is thenumberofstrings, not k
ClosestString as Hit & Miss For everyposition, need to choosethe letter ofsolutionstrings. For all stringssdiffers from at thatposition, increasedistance by one. Can’tmissanystring more thank times.
ClosestStringAlphabetReduction Canassumethatalphabetsize is at most n. 1111111111111111 1234123412342222 3214321443322114 1 1 2 1 2 2 1 2 1 1 2 2 111111111111 122212222222 221223232113
Column Types 1 1 2 1 1 2 1 1 2 1 1 2 111111111111 122212222222 221223232113 4 1 2 3 5 112 122 113 122 121
ClosestString ILP Afteralphabetreduction, thereare at most nncolumn types. Countthenumberofcolumnsofeachcolumn type.
ILP For eachcolumn type, make n variables, one for each letter. = numberofcolumnsof typetwherethesolutionpicksthe letter a. Constraints: For eachcolumn type t, thechosen letters add up to thenumberof type t.
ObjectiveFunction For a stringsi and column type t, letsi[t] be the letter ofsi in columnsof type t. For eachstringsi, itsdistance from thesolutionstrings is Objectiveis Minimize Max di
Algorithm for ClosestString Number of variables in the ILP is nnn so the final running time is FPTin n. (double exponential)
Conclusions (Integer) Linear Programming is a usefultoolfor parameterizedalgorithms. Has not yetbeenexploredin greatdepth
Exercises Show thatILP is NP-hard. Show thattheclausedeletionversionofAlmost 2-SAT is FPT by reductionto Almost 2-SAT. Book: 3.20, 3.23
Surplus The surplusof an independent set I is |N(I)| – |I|. The surplus can be negative! In any -LP solution, the total weight is n/2 + surplus(V0)/2. Solving the Vertex Cover LP is equivalent to finding an independent set I of minimum surplus.
Surplus and Reductions If «all ½» is the unique LP optimum then surplus(I) > 0 for all independent sets. Can we say anything meaningful for independent sets of surplus 1? 2? k?
Surplus Branching Lemma Let I be an independent set in G with minimum surplus. There exists an optimal vertex cover C that either containsI or avoidsI.
Surplus Branching Lemma Proof I N(I) R
BranchingRule Find an independentsetIof minimum surplus. Branch:Eitherput all ofIintosolution, or put all of N(I)intosolution. Correct by branching lemma. Need to analyzemeasuredropin bothbranches.
Branching Rule Find an independent set I of minimum surplus. Solve (G\I, k-|I|) and (G\N(I), k-|N(I)|). LP(G\I) > LP(G) - |I|, since otherwise LP(G) has an optimal solution that sets I to 1. So k-LP drops by at least ½.
Branching Rule Analysis Cont’d Analyzing the (G\N(I), k-N(I)) side: So k-LP drops by at least 1/2 = Best LPwith = 0 = FeasibleLP with = 0 v I N(I) 0 1
Branching Summary The measure k-LP drops by (½, surplus(I)/2). Will see that independent sets of surplus 1 can be reduced in polynomial time! Measure drops by (½,1) giving a time algorithm for Vertex Cover
Reducing Surplus 1 sets. Lemma: If surplus(I) = 1, I has minimum surplus and N(I) is not independent then there exists an optimum vertex cover containing N(I). I N(I) R
ReducingSurplus 1 Sets If surplus(I) = 1, I has minimum surplus and N(I) is notindependent, deleteN[I] and decreasek by |N(I)|. LPdecreases by at most |N(I)|(why?) So k - doesnot increase.
Reducing Surplus 1 sets. Reduction Rule: If surplus(I) = 1, I has minimum surplus and N(I) is independent then solve (G’,k-|I|)where G’ is G with N[I] contracted to a single vertex v. OPTLPdecreases by at most |I| (why?) I N(I) R