1 / 60

Exact Algorithms for Hard Problems

Exact Algorithms for Hard Problems. An introduction. This talk. Intro Exact algorithms Fixed parameter algorithms. Why?. Practical problems often NP-hard Must still be solved, so use slow exact algorithm Question: how fast can we do it? Here: analysis of worst case times

duscha
Télécharger la présentation

Exact Algorithms for Hard Problems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exact Algorithms for Hard Problems An introduction

  2. This talk • Intro • Exact algorithms • Fixed parameter algorithms Seminar

  3. Why? • Practical problems often NP-hard • Must still be solved, so use slow exact algorithm • Question: how fast can we do it? • Here: analysis of worst case times • Parameterized algorithms: sometimes something is small: answer, or parameter of input Seminar

  4. Exact algorithms • Take an NP-hard problem, and find an algorithm that solves it exactly, as fast as possible • Typical running time: O( cn) for some constant. • Try to get c as small as possible Seminar

  5. O*-notation • O*: suppress factors polynomial in input size from O-notation • O-notation: asympthotic • O(n3 2n) = O*(2n) • Note: O*(1.89286n) = O(1.8929n) Seminar

  6. History • Research done in the 1960s • Field somewhat forgotten for several years after discovery of NP-completeness theory • Popular research topic in 1990s en 2000s again • Recent new techniques: re-discovery of inclusion-exclusion; measure and conquer Seminar

  7. Techniques • Dynamic programming • Branch and Reduce • Measure and conquer analysis of branch and reduce • Inclusion-exclusion • Memorization • Preprocessing • Local search based • Treewidth • Faster algorithms for planar graphs, and generalizations (subexponential algorithms) Seminar

  8. Dynamic programming • Works for many problems • Not always fastest solutions, and use also exponential memory • Examples: • Partition into triangles: given a graph, can we partition the vertices into groups of 3, each forming a triangle? • O*(2n) • L(2,1)-coloring: color the vertices with numbers {1, …, k}, such that adjacent vertices have colors differ by 2, and vertices at distance 2 have colors differ by 1. • O*(4n). Faster algorithms are known Seminar

  9. Branch and reduce • Explained by Johan • Measure and conquer: better analysis Seminar

  10. Memorization • Technique to speed up some algorithms, explained in separate lecture Seminar

  11. Treewidth • Special type of dynamic programming • Also: branchwidth, pathwidth are similar and sometimes faster Seminar

  12. Faster algorithms for planar graphs • O*(csqrt(n)) or O*(csqrt(n)* log n) • Using treewidth/branchwidth dynamic programming algorithms • Planar graphs have treewidth O( sqrt(n)) • Generalizes to some other types of graphs: bounded genus, missing minor Seminar

  13. Fixed Parameter Complexity • Many problems have a parameter • Analysis what happens to problem when some parameter is small Seminar

  14. Motivation • In many applications, some number can be assumed to be small • Time of algorithm can be exponential in this small number, but should be polynomial in usual size of problem • Or something is fixed Seminar

  15. Parameterized problem • Given: Graph G, integer k, … • Parameter: k • Question: Does G have a ??? of size at least (at most) k? • Examples: vertex cover, independent set, coloring, … Seminar

  16. Examples of parameterized problems (1) Graph Coloring Given: Graph G, integer k Parameter: k Question: Is there a vertex coloring of G with k colors? (I.e., c: V ® {1, 2, …, k} with for all {v,w}Î E: c(v) ¹ c(w)?) • NP-complete, even when k=3. Seminar

  17. Clique • Subset W of the vertices in a graph, such that each pair has an edge Seminar

  18. Examples of parameterized problems (2) Clique Given: Graph G, integer k Parameter: k Question: Is there a clique in G of size at least k? • Solvable in O(nk) time with simple algorithm. Complicated algorithm gives O(n2k/3). Seems to require W(nf(k)) time… Seminar

  19. Vertex cover • Set of vertices W Í V with for all {x,y} Î E: xÎ W or y Î W. • Vertex Cover problem: • Given G, find vertex cover of minimum size Seminar

  20. Examples of parameterized problems (3) Vertex cover Given: Graph G, integer k Parameter: k Question: Is there a vertex cover of G of size at most k? • Solvable in O(2k (n+m)) time Seminar

  21. Three types of complexity • When the parameter is fixed • Still NP-complete (k-coloring, take k=3) • O(f(k) nc) • O(nf(k)) Seminar

  22. Fixed parameter complexity theory • To distinguish between behavior: • O( f(k) * nc) • W( nf(k)) • Proposed by Downey and Fellows. Seminar

  23. Parameterized problems • Instances of the form (x,k) • I.e., we have a second parameter • Decision problem (subset of {0,1}* xN) Seminar

  24. Fixed parameter tractable problems • FPT is the class of problems with an algorithm that solves instances of the form (x,k) in time p(|x|)*f(k), for polynomial p and some function f. Seminar

  25. Hard problems • Complexity classes • W[1] Í W[2] Í … W[i] Í … W[P] • Defined in terms of Boolean circuits • Problems hard for W[1] or larger class are assumed not to be in FPT • Compare with P / NP Seminar

  26. Examples of hard problems • Clique and Independent Set are W[1]-complete • Dominating Set is W[2]-complete • Version of Satisfiability is W[1]-complete • Given: set of clauses, k • Parameter:k • Question: can we set (at most) k variables to true, and al others to false, and make all clauses true? Seminar

  27. So what is parameterized complexity about? • Given a parameterized problem • Establish that it is in FPT • And then design an algorithm that is as fast as possible • Or show that it is hard for W[1] or “higher” • Try to find a polynomial time algorithm for fixed parameter • Or even show that it is NP-complete for fixed parameters • Solve it with different techniques (exact or approximation) Seminar

  28. FPT techniques • Branching algorithms • Bounded search trees • Greedy localization • Color coding • Kernelisation (local rules, global rules) • Induction • Iterative compression • Extremal method • Win/Win • Well quasi ordering • Structures (e.g., treewidth) FollowingSloper/Telle taxonomy Seminar

  29. Branching • More or less classic technique of search tree • Counting argument helps to keep size of search tree small • At each step, we recursively create a number of subproblems: answer is yes, if and only if at least one subproblem has yes as answer Seminar

  30. Vertex cover • First example: vertex cover • Select an edge {v,w}. Note that a solution includes v or it includes w • If we include v, we can ignore all edges incident to v in subproblems v w Seminar

  31. Branching algorithm for Vertex Cover • Recursive procedure VC(Graph G, int k) • VC(G=(V,E), k) • If G has no edges, then return true • If k == 0, then return false • Select an edge {v,w} Î E • Compute G’ = G [V – v] (remove v and incident edges) • Compute G” = G [V – w] (remove w and incident edges) • Return VC(G’,k – 1) or VC(G”,k – 1) Seminar

  32. Analysis of algorithm • Correctness • Either v or w must belong to an optimal VC • Time analysis • At most 2.2k recursive calls • Each recursive call costs O(n+m) time • O(2k(n+m)) time: FPT Seminar

  33. Color coding • Interesting algorithmic technique to give fast FPT algorithms • As example: • Long Path • Given: Graph G=(V,E), integer k • Parameter: k • Question: is there a simple path in G with at least k vertices? Seminar

  34. Problem on colored graphs • Given: graph G=(V,E), for each vertex v a color in {1,2, … , k} • Question: Is there a simple path in G with k vertices of different colors? • Note: vertices with the same colors may be adjacent. • Can be solved in O(2k (nm)) time using dynamic programming • Used as subroutine… Seminar

  35. DP • Tabulate: • (S,v): S is a set of colors, v a vertex, such that there is a path using vertices with colors in S, and ending in v • Using Dynamic Programming, we can tabulate all such pairs, and thus decide if the requested path exists Seminar

  36. A randomized variant • For each vertex v, guess a colorin {1, 2, …, k} • Check if there is a path of length k with only vertices with different colors • Note: • If there is a path of length k, we find one with positive chance ( 2k/k!) • We can do this check in O(2knm) time • Repeat the check many times to get good probability for finding the path Seminar

  37. Derandomisation • Instead of randomly selecting a coloring, check all colorings from a k-perfect family of hash functions • A k-perfect family of hash functions on a set Vis a collection H of functions V ® {1, …,k}, such that for each set W Í V, |W|=k, there exists an h Î H with h(W) = {1, …,k} • Algorithm: • Generate a k-perfect family of hash functions • For each function in the set, check for the properly colored path of length k Seminar

  38. Existence and generation of k-perfect families of hash functions • Alon et al. (1995): collection with O(ck log n) functions exist and can be deterministically generated • Hence: O((2c)k nm log n) algorithm for Longest Path • Generate all elements of k-perfect family of hash functions, and for each, solve the colored version with dynamic programming • Refined techniques exist Seminar

  39. Remember Cook’s theorem • NP-completeness helps to distinguish between decision problems for which we have a polynomial time algorithm, and those for which we expect no such algorithm exists • NP-hard; NP-completeness; reductions • Cook’s theorem: `first’ NP-complete problem; used to prove others to be NP-complete • Similar theory for parameterized problems by Downey and Fellows Seminar

  40. Classes • FPT Í W[1] Í W[2] Í W[3] Í … Í W[i] Í … Í W[P] • Theoretical reasons to believe that hierarchy is strict Seminar

  41. Parameterized m-reduction • Let L, L’ be parameterized problems. • A standard parameterized m-reduction transforms an input (I,k) of L to an input (f(I,k), g(k)) of L’ • L((I,k)) if and only if L’((f(I,k), g(k)) • f uses time p(|I|)* h(k) for a polynomial p, and some function h • Note: time may be exponential or worse in k • Note: the parameter only depends on parameter, not on rest of the input Seminar

  42. A Complete Problem • Classes W[1], … are defined in terms of circuits (definition skipped here) • Short Turing Machine Acceptance • Given: A non-deterministic Turing machine M, input x, integer k • Parameter: k • Question: Does M accept x in a computation with at most k steps? • Short Turing Machine Acceptance is W[1]-complete (compare Cook) • Note: easily solvable in O(nk+c) time Seminar

  43. More complete problems for W[1] • Weighted q-CNF Satisfiability • Given: Boolean formula in CNF, such that each clause has at most q literals, integer k • Parameter: k • Question: Can we satisfy the formula by making at most k literals true? • For each fixed q > 1, Weighted q-CNF Satisfiability is complete for W[1]. Seminar

  44. Hard problems • Independent Set, Clique: W[1]-complete • Dominating Set: W[2]-complete • Longest Common Subsequence III: W[1]-complete (complex reduction to Clique) • Given: set of k strings S1, …, Sk, integer m • Parameter: k, m • Question: is there a string S of length m that is a subsequence of each string Si, 1 £ i £k? Seminar

  45. Example of reduction • Precedence constrained K-processor scheduling • Instance: set of tasks T, each taking 1 unit of time, partial order < on tasks, deadline D, number of processors K • Parameter: K • Question: can we carry out the tasks on K processors, such that • If task1 < task2, then task1 is carried out before task2 • At most one task per time step per processor • All tasks finished at most at time D Seminar

  46. Transform from Dominating Set • Let G=(V,E), k be instance of DS • Write n = |V|, c = n2, D = knc + 2n. • Take the following tasks and precedences: • Floor: D tasks in “series”: 1 2 3 … … … … D-2 D-1 D Seminar

  47. Floor gadgets • For all j of the form j = n-1+ ac + bn (0 £a < kn, 1 £b £ n), take a task that must happen on time j (parallel to the jth floor vertex) 1 2 … j-1 j j+1 … … D-1 D Seminar

  48. Selector paths • We take k paths of length D-n+1 • Each models a vertex from the dominating set • To some vertices on the path, we also take parallel vertices: • If {vi, vj} Ï E, and i ¹ j, then place a vertex parallel to the n-1+ac+in-jth vertex for all a, 0 £a < kn 1 … … … … … … … … … D-n-1 Seminar

  49. Lemma and Theorem • Lemma: we can schedule this set of tasks with deadline D and 2k processors, if and only if G has a dominating set of size at most k • Theorem: Precedence constrained k-processor scheduling is W[2]-hard • Note: size of instance must depend in polynomial way on size of G (and hence on k < |V|) • It is allowed to use transformations where new parameter is exponential in old parameter Seminar

  50. Conclusions • Fixed parameter proofs: method of showing that a problem probably has no FPT-algorithms • Often complicated proof  • But not always  Seminar

More Related