‣ Poly-Time Reductions ‣ Packing and Covering Problems ‣ Constraint
Total Page:16
File Type:pdf, Size:1020Kb
8. INTRACTABILITY I 8. INTRACTABILITY I ‣ poly-time reductions ‣ poly-time reductions ‣ packing and covering problems ‣ packing and covering problems ‣ constraint satisfaction problems ‣ constraint satisfaction problems ‣ sequencing problems ‣ sequencing problems ‣ partitioning problems ‣ partitioning problems ‣ graph coloring ‣ graph coloring ‣ numerical problems ‣ numerical problems SECTION 8.1 Lecture slides by Kevin Wayne Copyright © 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on 2/25/20 3:57 PM Algorithm design patterns and antipatterns Classify problems according to computational requirements Algorithm design patterns. Q. Which problems will we be able to solve in practice? ・Greedy. ・Divide and conquer. A working definition. Those with poly-time algorithms. ・Dynamic programming. ・Duality. ・Reductions. ・Local search. ・Randomization. von Neumann Nash Gödel Cobham Edmonds Rabin (1953) (1955) (1956) (1964) (1965) (1966) Algorithm design antipatterns. Turing machine, word RAM, uniform circuits, … ・NP-completeness. O(nk) algorithm unlikely. ・PSPACE-completeness. O(nk) certification algorithm unlikely. Theory. Definition is broad and robust. ・Undecidability. No algorithm possible. constants tend to be small, e.g., 3 n 2 Practice. Poly-time algorithms scale to huge problems. 3 4 Classify problems according to computational requirements Classify problems Q. Which problems will we be able to solve in practice? Desiderata. Classify problems according to those that can be solved in polynomial time and those that cannot. A working definition. Those with poly-time algorithms. input size = c + log k Provably requires exponential time. ・Given a constant-size program, does it halt in at most k steps? yes probably no ・Given a board position in an n-by-n generalization of checkers, shortest path longest path can black guarantee a win? using forced capture rule min cut max cut 2-satisfiability 3-satisfiability planar 4-colorability planar 3-colorability bipartite vertex cover vertex cover matching 3d-matching primality testing factoring Frustrating news. Huge number of fundamental problems have defied linear programming integer linear programming classification for decades. 5 6 Poly-time reductions Poly-time reductions Desiderata′. Suppose we could solve problem Y in polynomial time. Desiderata′. Suppose we could solve problem Y in polynomial time. What else could we solve in polynomial time? What else could we solve in polynomial time? Reduction. Problem X polynomial-time (Cook) reduces to problem Y if Reduction. Problem X polynomial-time (Cook) reduces to problem Y if arbitrary instances of problem X can be solved using: arbitrary instances of problem X can be solved using: ・Polynomial number of standard computational steps, plus ・Polynomial number of standard computational steps, plus ・Polynomial number of calls to oracle that solves problem Y. ・Polynomial number of calls to oracle that solves problem Y. computational model supplemented by special piece of hardware that solves instances of Y in a single step Notation. X ≤ P Y. Note. We pay for time to write down instances of Y sent to oracle ⇒ instances of Y must be of polynomial size. Algorithm instance I solution S to I for Y (of X) Novice mistake. Confusing X ≤ P Y with Y ≤ P X. Algorithm for X 7 8 Intractability: quiz 1 Intractability: quiz 2 Suppose that X ≤ P Y. Which of the following can we infer? Which of the following poly-time reductions are known? O(mn2) time: Dinitz’ algorithm A. If X can be solved in polynomial time, then so can Y. A. FIND-MAX-FLOW ≤ P FIND-MIN-CUT. O(m) time: given max flow f, B. X can be solved in poly time iff Y can be solved in poly time. B. FIND-MIN-CUT ≤ FIND-MAX-FLOW. P let A = set of nodes reachable from s in Gf C. If X cannot be solved in polynomial time, then neither can Y. C. Both A and B. D. If Y cannot be solved in polynomial time, then neither can X. D. Neither A nor B. 9 10 Poly-time reductions Design algorithms. If X ≤ P Y and Y can be solved in polynomial time, then X can be solved in polynomial time. 8. INTRACTABILITY I Establish intractability. If X ≤ P Y and X cannot be solved in polynomial time, ‣ poly-time reductions then Y cannot be solved in polynomial time. ‣ packing and covering problems ‣ constraint satisfaction problems Establish equivalence. If both X ≤ P Y and Y ≤ P X, we use notation X ≡ P Y. In this case, X can be solved in polynomial time iff Y can be. ‣ sequencing problems ‣ partitioning problems ‣ graph coloring ‣ numerical problems SECTION 8.1 Bottom line. Reductions classify problems according to relative difficulty. 11 Independent set Vertex cover INDEPENDENT-SET. Given a graph G = (V, E) and an integer k, is there VERTEX-COVER. Given a graph G = (V, E) and an integer k, is there a a subset of k (or more) vertices such that no two are adjacent? subset of k (or fewer) vertices such that each edge is incident to at least one vertex in the subset? Ex. Is there an independent set of size ≥ 6 ? Ex. Is there an independent set of size ≥ 7 ? Ex. Is there a vertex cover of size ≤ 4 ? Ex. Is there a vertex cover of size ≤ 3 ? independent set of size 6 independent set of size 6 vertex cover of size 4 13 14 Intractability: quiz 3 Vertex cover and independent set reduce to one another Consider the following graph G. Which are true? Theorem. INDEPENDENT-SET ≡ P VERTEX-COVER. Pf. We show S is an independent set of size k iff V − S is a vertex cover of size n – k. A. The white vertices are a vertex cover of size 7. B. The black vertices are an independent set of size 3. C. Both A and B. D. Neither A nor B. independent set of size 6 vertex cover of size 4 15 16 Vertex cover and independent set reduce to one another Vertex cover and independent set reduce to one another Theorem. INDEPENDENT-SET ≡ P VERTEX-COVER. Theorem. INDEPENDENT-SET ≡ P VERTEX-COVER. Pf. We show S is an independent set of size k iff V − S is a vertex cover Pf. We show S is an independent set of size k iff V − S is a vertex cover of size n – k. of size n – k. ⇒ ⇐ ・Let S be any independent set of size k. ・Let V − S be any vertex cover of size n – k. ・V − S is of size n – k. ・S is of size k. ・Consider an arbitrary edge (u, v) ∈ E. ・Consider an arbitrary edge (u, v) ∈ E. ・S independent ⇒ either u ∉ S, or v ∉ S, or both. ・V − S is a vertex cover ⇒ either u ∈ V − S, or v ∈ V − S, or both. ⇒ either u ∈ V − S, or v ∈ V − S, or both. ⇒ either u ∉ S, or v ∉ S, or both. ・Thus, V − S covers (u, v). ▪ ・Thus, S is an independent set. ▪ 17 18 Set cover Intractability: quiz 4 SET-COVER. Given a set U of elements, a collection S of subsets of U, and an Given the universe U = { 1, 2, 3, 4, 5, 6, 7 } and the following sets, integer k, are there ≤ k of these subsets whose union is equal to U ? which is the minimum size of a set cover? Sample application. A. 1 U = { 1, 2, 3, 4, 5, 6, 7 } m available pieces of software. ・ S = { 1, 4, 6 } S = { 1, 6, 7 } ・Set U of n capabilities that we would like our system to have. B. 2 a b th S = { 1, 2, 3, 6 } S = { 1, 3, 5, 7 } ・The i piece of software provides the set Si ⊆ U of capabilities. C. 3 c d Goal: achieve all n capabilities using fewest pieces of software. S = { 2, 6, 7 } S = { 3, 4, 5 } ・ D. None of the above. e f U = { 1, 2, 3, 4, 5, 6, 7 } Sa = { 3, 7 } Sb = { 2, 4 } Sc = { 3, 4, 5, 6 } Sd = { 5 } Se = { 1 } Sf = { 1, 2, 6, 7 } k = 2 a set cover instance 19 20 Vertex cover reduces to set cover Vertex cover reduces to set cover Theorem. VERTEX-COVER ≤ P SET-COVER. Lemma. G = (V, E) contains a vertex cover of size k iff (U, S, k) contains Pf. Given a VERTEX-COVER instance G = (V, E) and k, we construct a a set cover of size k. SET-COVER instance (U, S, k) that has a set cover of size k iff G has a vertex cover of size k. Pf. ⇒ Let X ⊆ V be a vertex cover of size k in G. “yes” instances of VERTEX-COVER are solved correctly ・Then Y = { Sv : v ∈ X } is a set cover of size k. ▪ Construction. ・Universe U = E. ・Include one subset for each node v ∈ V : Sv = {e ∈ E : e incident to v }. a b a b e7 e2 e4 U = { 1, 2, 3, 4, 5, 6, 7 } e7 e2 e4 U = { 1, 2, 3, 4, 5, 6, 7 } e3 e3 Sa = { 3, 7 } Sb = { 2, 4 } Sa = { 3, 7 } Sb = { 2, 4 } f e6 c f e6 c Sc = { 3, 4, 5, 6 } Sd = { 5 } Sc = { 3, 4, 5, 6 } Sd = { 5 } e5 e5 e1 Se = { 1 } Sf = { 1, 2, 6, 7 } e1 Se = { 1 } Sf = { 1, 2, 6, 7 } e d e d vertex cover instance set cover instance vertex cover instance set cover instance (k = 2) (k = 2) (k = 2) (k = 2) 21 22 Vertex cover reduces to set cover Lemma. G = (V, E) contains a vertex cover of size k iff (U, S, k) contains a set cover of size k. 8. INTRACTABILITY I Pf. ⇐ Let Y ⊆ S be a set cover of size k in (U, S, k).