580 likes | 843 Views
Insert « Academic unit» on every page: 1 Go to the menu «Insert» 2 Choose: Date and time 3 Write the name of your faculty or department in the field «Footer» 4 Choose «Apply to all". Parameterized Algorithms The Basics. Bart M. P. Jansen. August 18th 2014, Będlewo. Why we are here.
E N D
Insert«Academic unit» on every page:1 Go to the menu «Insert»2 Choose: Date and time3 Write the name of your faculty or department in the field «Footer» 4 Choose «Apply to all" Parameterized AlgorithmsThe Basics Bart M. P. Jansen August 18th 2014, Będlewo
Why we are here • To create the recipes that make computers solve our problems efficiently • With a bounded number of resources (memory, time) • We measure the quality of an algorithm by the dependence of its running time on the size of the input • For an -bit input, the running time can be • Smaller functions are better, but as a general guideline: • Polynomials are good, exponential functions are bad • Unfortunately, many problems are NP-complete • We believe that for NP-complete problems, there is no algorithm that: • always gives the right answer, and whose • running time is bounded by a polynomial function of the input size
Dealing with NP-complete problems • Approximation • Sacrificequality of the solution: quicklyfind a solution that is provablynotvery bad • Local search • Quicklyfind a solution forwhichyoucannotgiveanyqualityguarantee (but whichmightoftenbegood) • Branch & bound • Sacrifice running time guarantees: createanalgorithmforwhichyou do notknowhow long itwill take (but whichmight do well on the inputsyouuse) • Parameterizedalgorithms • Sacrifice the running time: allow the running time to have anexponential factor, but ensurethat the exponentialdependence is not on the entire input size but just on some parameter that is hopefully small • Kernelization • Quicklyshrink the input bypreprocessingsothatafterward running anexponential-time algorithm on the shrunkinstance is fastenough
History of parameterized complexity PCP Theorem Downey & Fellows book Kernelization lower bounds NP-completeness 1940 1950 1960 1970 1980 1990 2000 2010 … Będlewo school Parameterized(in)tractability Matching algorithm Graph Minors Theorem Simplex algorithm Planar Dominating Set kernel
Parameterized problems • As usual in complexity theory, we primarily study decision problems (yes/no questions) • optimization: “Find the shortest path from to ” • decision: “Is there a path from to of length at most ?” • Having an efficient algorithm for one typically gives an efficient algorithm for the other • A parameterized problem is a decision problem where we associate an integer parameterto each instance • The parameter measures some aspect of the instance
Problem parameterizations • Packet Delivery Problem Input: A graph , a starting vertex , a set of delivery vertices, and an integer Question: Is there a cycle in that starts and ends in , visits all vertices in , and has length at most ? • There are many possible parameters for this problem: • The length of the tour • The number of delivery points • Graph-theoretic measures of how complex is (treewidth, cliquewidth, vertex cover number) • Parameterized complexity investigates: • Can the problem be solved efficiently, if the parameter is small?
Fixed-parameter tractability – informally • A parameterized problem is fixed-parameter tractable if there is an algorithm that solves size- inputs with parameter value in time for some constant and function • For each fixed , there is a polynomial-time algorithm • Vertex Cover: • “Can all the edges of this -vertex graph be covered by at most vertices?” • Solvable in time , so FPT
Fixed-parameter tractability – formally • Let be a finite alphabet used to encode inputs • ( for binary encodings) • A parameterized problem is a set • The set contains the tuples where the answer to the question encoded by is yes; is the parameter • The parameterized problem is fixed-parameter tractable if there is an algorithm that, given an input , • decides if belongs to or not, and • runs in time for some function and constant
Data reductionwith a guarantee • Kernelization is a methodforparameterizedpreprocessing • Efficientlyreduceaninstancetoan equivalent instance of sizeboundedbysome • One of the simplestways of obtaining FPT algorithms • Apply a brute force algorithm on the shrunkinstanceto get an FPT algorithm • Kernelizationalsoallows a rigorousmathematical analysis of efficientpreprocessing
The Vertex Cover problem Input: An undirectedgraph and an integer Parameter: Question: Is there a set of at most vertices in , such that each edge of has an endpoint in ? • Such a set S is a vertex cover of
ReductionrulesforVertex Cover – (R1) (R1) Ifthere is anisolated vertex , delete from • Reduceto the instance
ReductionrulesforVertex Cover – (R1) (R1) Ifthere is anisolated vertex , delete from • Reduceto the instance • Toensurethat a reductionrule does not change the answer, we have to prove safeness of the reductionrule • If is transformedintothen we should prove that: is a yes-instance is a yes-instance
ReductionrulesforVertex Cover – (R1) (R1) Ifthere is anisolated vertex , delete from • Reduceto the instance
ReductionrulesforVertex Cover – (R2) (R2) Ifthere is a vertex of degree more than, then delete (andits incident edges) fromanddecrease the parameter by 1 • Reduceto the instance
ReductionrulesforVertex Cover – (R3) (R3) If the previousrules are notapplicableand has more thanvertices or more thanedges, thenconcludethat we are dealingwith a no-instance
Correctness of the cutoff rule • Claim.Ifis exhaustivelyreducedunder (R1)-(R2) and has more thanvertices or edges, thenthere is no size- vertex cover • Proof. • Suppose has a vertex cover • Since(R1) does notapply, everyvertex of has at leastoneedge • Since (R2) does notapply, every vertex has degree at most : • So • Soif has a size- vertex cover, and S
PreprocessingforVertex Cover • (R1)-(R3) canbeexhaustivelyapplied in polynomial time • In polynomial time, we canreduce a Vertex Coverinstance to an instance such that: • the twoinstances are equivalent: has answer yes if and only if has answer yes • instance has at most vertices and edges • Thisgivesan FPT algorithmtosolveaninstance: • Computereducedinstance • Solve by brute force: try all vertex subsets • For each , test if it is a vertex cover of size at most Theorem.-Vertex Coveris fixed-parameter tractable
Kernelization – formally • Let be a parameterizedproblemand • A kernelization (or kernel) for of size is an algorithm that, given , takes time polynomial in , and outputs an instance such that: • A polynomialkernel is a kernelwhosefunction is a polynomial • Theorem. A parameterized problem is fixed-parameter tractable if and only if it is decidable and has a kernel (of arbitrary size)
KernelforFeedback Arc Set in Tournaments Input: A tournament and an integer Parameter: Question: Is there a set of at most directed edges in , such that is acyclic?
ReductionrulesforFeedback Arc Set (R1) If vertex is not in any triangle, then remove (R2) If edge is in at least distinct triangles, reverse it and decrease by one (R3) If the previousrules are notapplicableand has more thanvertices, thenconcludethat we are dealingwith a no-instance Theorem.-Feedback Arc Set in Tournaments has a kernelwith vertices
High-level kernelizationstrategy • ComparetoVertex Cover: • (R1) deals withelementsthat do notconstrainthe solution • (R2) deals withelementsthat must be in any solution • (R3) deals withgraphsthatremain large afterreduction
Background • A branching algorithm that explores a search tree of bounded depth is one of the simplest types of FPT algorithms • Main idea: • Reduce problem instance to solving a bounded number of instances with parameter • If you can solve in polynomial time using the answers to two instances and , then the problem can be solved in time • (assuming the case is polynomial-time solvable) • If you generate subproblems instead of 2, then the problem can be solved in time
Analysis of bounded-depth search trees • If the parameter decreasesforeachrecursive call, the depth of the tree is at most • # nodes in a depth- tree withleaves is • Usuallysufficienttobound the number of leaves • If the computation in each node takes polynomial time, total running time is
Vertex Cover revisited Input: A graph and an integer Parameter: Question: Is there a set of at most vertices in , such that each edge has an endpoint in ?
Algorithm for Vertex Cover • Algorithm VC(Graph , integer ) • if then return no • if has no edges then returnyes • else pick an edge in and let andbeitsendpoints • return (VCor (VC) • Correct becauseany vertex cover must use or • A size- vertex cover in G thatuses, yields a size- vertex cover in
Running time forVertex Cover • Every iteration eithersolves the problemdirectly or makestworecursive calls with a decreased parameter • The branching factor of the algorithm–andtherefore of the search tree–is two • Tree of depthwithbranching factor has at most leaves • Running time is • Muchbetterthan from the kernelization algorithm • One way tofasteralgorithms: • Pick a vertex of maximum degree, recurse on and
The Feedback Vertex Set problem Input: An undirected (multi)graph and an integer Parameter: Question: Is there a set of at most vertices in , such that each cycle contains a vertex of ? • We allow multiple edgesandself-loops • Such a set is a feedback vertex setof • Removingfromresults in anacyclicgraph, a forest
BranchingforFeedback Vertex Set • For Vertex Cover, we couldeasilyidentify a set of verticestobranch on: the twoendpointsof anedge • For feedback vertex set, a solution maynotcontainanyendpoint of anedge • How should we branch? • We willfind a set of vertices such that any size- feedback vertex set contains a vertex of • Tofind we first have tosimplify the graphusingreductionrulesthat do not change the answer
Reductionrules (R1) Ifthere is a loop at vertex , then delete anddecreasebyone (R2) Ifthere is anedge of multiplicitylargerthan, thenreduceitsmultiplicityto (R3) Ifthere is a vertex of degree at most , then delete (R4) Ifthere is a vertex of degreetwo, then delete andaddanedgebetween’s neighbors • If (R1-R4) cannot be applied anymore, then the minimum degree is at least • Observation. If is transformed into , then: • fvs of size in fvs of size in • Any feedback vertex set in is a feedback vertex set in when combined with the vertices deleted by (R1)
Identifying a set tobranch on • Let be a graphwhosevertices have degreethree or more • Order the vertices as bydecreasingdegree • Let be the largest-degreevertices • Lemma.Ifallvertices of have degree 3 or more, thenanysize- feedback vertex set of contains a vertex from • Soifthere is a size- solution, itcontains a vertex of • For eachrecurse on the instance • Givesanalgorithmwith running time • Apply the reductionrules, compute, thenbranch
A useful claim • Claim.Ifis a feedback vertex set of , then • Proof. Graph is a forest • So • Everyedgenot in , is incident with a vertex of • Withthis claim, we can prove the degree lemma
Proving the degree lemma • Lemma. Ifallvertices of have degree 3 or more, thenanysize-feedback vertex set of G contains a vertex from • Proofbycontradiction. • Let be a size-feedback vertex set with • Bychoice of we have: , so: • Define. Since : By the previous claim
Proving the degreelemma (II) • The degreesumcountseveryedgetwice: • Combining these: • So • But sinceallvertices have degree we have: • Contradiction
A final word on bounded-depth search trees • The degree lemma proves the correctness of ourbranchingstrategyforFeedback Vertex Set • When building a branchingalgorithmfor a parameterizationby the solution size: • Findan-size set thatcontains a vertex of the solution • Branch in directions, tryingallpossibilities • We get a search tree of depthandbranching factor • Youcanthink of the branchingprocess as guessing
The Set Cover problem Input: A set family over a universe and an integer Parameter: Question: Is there a subfamily of at most sets, such that • The subfamilycovers the universe • Set Coverparameterizedby the universesize is FPT • Algorithmwith running time • Based on dynamicprogramming
DynamicprogrammingforSet Cover • Let • We define a DP tableforand = min nr. of sets from needed to cover Or if impossible • The value gives the minimum size of a set cover • Tosolve the problem, compute using base cases and a recurrence
Filling the dynamicprogrammingtable • = min nr. of sets from needed to cover Base case: if , otherwise it is Recursive step: • Skip set , or pay for and afterwards cover • Each entry canbecomputed in polynomial time • entries in total
More on dynamicprogramming • Dynamic programming is a memory-intensive algorithmicparadigmthatyields FPT algorithms in varioussituations • Here: dynamicprogramming over subsets of • Later: dynamicprogramming over tree decompositions • Research challenge: • Determinewhether the factor canbeimprovedtoforsome
Summary • Parameterizedalgorithmics is a young, vibrant research area thatinvestigateshowtocopewith NP-completeness • We sawthreeways of building FPT algorithms: • Kernelization • Bounded-depthsearch trees • Dynamicprogramming over subsets