11/3/08 Let’s Review… The Turing Machine NP-Complete Problems Build a theoretical a “human computer” Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical machine provides a means to determine: If an algorithm or procedure exists for a given problem What that algorithm or procedure looks like How long would it take to run this algorithm or procedure. The Church-Turing Thesis (1936) Are you a good witch? Any algorithmic procedure that can be So what should be the cutoff between a “good” algorithm and a “bad” algorithm? carried out by a human or group of In the 1960s, Jack Edmonds proposed: humans can be carried out by some A “good” algorithm is one whose running time is a polynomial function of the size of the input Turing Machine” Other algorithms are “bad” Equating algorithm with running on a TM This definition was adopted: A problem is called tractable if there exists a Turing Machine is still a valid “good” (polynomial time) algorithm that solves it. computational model for most modern A problem is called intractable otherwise. computers. The class P The class NP The class NP contains all decision problems that are The class P contains all decision problems that are decidable by a non-deterministic “algorithm” that decidable by an “algorithm” that runs in polynomial runs in polynomial time. time. For each w accepted, there is at least one accepting Does this define a class of languages? sequence that will run in polynomial time. Yes… Does this define a class of languages? -- Yes… The set of all problems whose encodings of “yes instances” (a The set of all problems whose encodings of “yes instances” (a language) is recognized by a TM M language) is recognized by a NDTM M M recognizes the above language in Polynomial Time. M recognizes the above language in Polynomial Time. Recall: These languages are recursive 1
11/3/08 Reducing one language to Reducing one language to another another Worked well for decidability…Let’s use it here. Basic idea Take an encoding of one problem Instance Corresponding Conversion Convert it to another problem we know to be in P or NP of P 1 TM Conversion must be done in polynomial time! TM Instance of P 2 recognizing Runs in Ptime L 2 Runs in Ptime YES NO The class NP-complete The class NP-complete Implications The hardest of the problems in class NP are in the class of NP-complete problems: Hardest problem A language L is in NP if It’s probably not worth looking for a solution for an NP-complete problem L ∈ NP How do we show a problem to be NP-complete For every other language L 1 ∈ NP L 1 ≤ p L Reduction All NP-complete problems are “equally” difficult. We need a NP-complete problem to kick things off. Satisfiability (SAT) Theory Hall of Fame INSTANCE Steven Cook A local boy A Logical expression containing b. Buffalo, NY. variables x i PhD – Harvard (1966) logical connectors &, |, and ! At Berkley from 1966-1970 PROBLEM At University of Toronto since Is there an assignment of truth values to 1970 each of the variables such that the Published this Theorem in 1971. expression will evaluate to true. 2
11/3/08 Cook’s Theorem NP Complete Problems SATISFIABILITY is NP-Complete Why show that a problem is NP complete. Reduced any TM in NP to SAT Shown by describing workings of a NDTM These problems are the hardest to solve. as an expression involving boolean Unlikely you will find an efficient algorithm variables to solve them. Now we have a problem to start the ball rolling! Lot’s of NP Complete Problems The big 7 When confronted with trying to show a Basic core of known NP-complete problem is NP-Complete problems. There are lots to chose from which to Basis for beginner in chosing a problem for perform a reduction. reduction Note: I will not cover the actual reductions Over 300 NP-Complete problems listed See Garey and Johnson for details. (and the book was published in 1979!) Wikipedia reports over 3000 known NP complete problems today Describing NP-Complete The Big Daddy Problems SATISFIABILITY (SAT) NAME: Name of problem INSTANCE INSTANCE or INPUT A set of U boolean variables and a collection C On what input is the problem defined. of boolean clauses over U PROBLEM or OUTPUT PROBLEM Under what condition will the answer to the Is there a satisfying truth assignment for C? problem be “yes”. REDUCED FROM: The one that started it all! From what NP-Complete problem has this been reduced 3
11/3/08 The other 6 3SAT 3-SATISFIABILITY (3SAT) INSTANCE: Instance Collection C = {c 1 ,c 2 , …, c m } of boolean Corresponding Conversion of SAT clauses on a finite set of boolean variables U TM Instance of 3SAT such that each c i contains exactly 3 variables. Runs in Ptime PROBLEM: Is there a truth assignment for U that satisfies Boolean expression of SAT is satisfiable iff all clauses of C corresponding boolean expression of 3SAT REDUCED FROM: SAT is satisfiable. The other 6 The other 6 3-DIMENSIONAL MATCHING (3DM) 3-DIMENSIONAL MATCHING (3DM) Marriage problem with an extra dimension (add a Informally: pet). A generalization of the “marriage” problem Given: n unmarried men Given: n unmarried women n unmarried men n unowned pets n unmarried women a list of triplets of partners who would marry and the pet a list of pairs of partners who would marry they want Can you arrange n marriages, with a pet as a wedding Can you arrange n marriages that avoid gift, that avoid polygomy and makes everyone happy… polygomy and makes everyone happy. including the pet! The other 6 The other 6 3-DIMENSIONAL MATCHING (3DM) The next 3 are all related to graph INSTANCE: theory A set M ⊆ (W x X x Y) where W, X, Y are Vertex Cover disjoint sets having the same number of Clique elements PROBLEM Hamiltonian Circuit Does M contain a matching A subset M’ ⊆ M such that M’ has the same size as M and no 2 elements in M’ agree in any coordinate. REDUCED FROM: 3SAT 4
11/3/08 The other 6: Graph Algorithms The other 6: Graph Algorithms VERTEX COVER VERTEX COVER (VC) The vertex cover of a graph G is a set of INSTANCE: vertices V so that every edge of G is A Graph G = (V,E) and integer k ≤ |V| incident to at least one vertex in V. PROBLEM: Is there a vertex cover of size k or less on G Subset of vertices V’ such that for each edge {u,v}, at least one of u and v belongs to V’ REDUCED FROM: 3SAT Mathworld The other 6: Graph Algorithms The other 6: Graph Algorithms CLIQUE CLIQUE A clique of a graph G is any complete INSTANCE: subgraph (any subset of vertices in which A Graph G = (V,E) and integer k ≤ |V| each pair of graph vertices is connected by PROBLEM: an edge) Does G contain a clique of size k or more. A subset of vertices, V’ such that every 2 vertices in V’ are joined by an edge REDUCED FROM: VC Mathworld The other 6: Graph Algorithms The other 6: Graph Algorithms HAMILTONIAN CIRCUIT HAMILTONIAN CIRCUIT (HC) A Hamiltonian circuit is a cycle in an INSTANCE: undirected graph which visits each vertex A Graph G = (V,E) exactly once and also returns to the PROBLEM: starting vertex. Does G contain a hamiltonian circuit An ordering of all vertices <v 1 ,v 2 , …, v n > such that {v i , v j } is an edge and {v n , v 1 } is an edge. REDUCED FROM: VC Mathworld 5
11/3/08 The other 6: one from set The other 6: one from set theory theory PARTITION PARTITION INSTANCE: given a multiset S of integers, is there a A finite set A and a “size function” s(a) a ∈ A way to partition S into two subsets S1 and PROBLEM: S2 such that the sums of the numbers in Is there a subset A’ ⊆ A such that each subset are equal? s ( a ) s ( a ) ∑ ∑ = The subsets S1 and S2 must form a partition in the sense that they are disjoint a A ' a A A ' ∈ ∈ − and they cover S. REDUCED FROM: 3DM The big 7 The big 7 Listed in the original list of 21 NP SAT complete problems as published by 3-SAT Karp Landmark works: 3DM VC The Complexity of Theorem Proving Procedures” by Steven Cook, 1971 HC PARTITION CLIQUE “Reducibility Among Combinatorial Problems” by Richard Karp, 1972 Lots and Lots of NP Complete Problems Problem Categories Graph Theory Algebra and Number Theory Network Design Games and Puzzles Sets and Partitions, Logic Storage and Retrieval SAT, 3SAT Database Related Problems, Data Storage, Sparse Automata and Languages Matrix Compression Program Optimization Sequence and Scheduling Program Equivalences Multiprocessor Scheduling Mathematical Programming Other Linear Programming 6
Recommend
More recommend