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