1 / 26

NP-completeness

NP-completeness. Lecture 2: Jan 11. P. The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many problems that we don’t know how to solve in polynomial time. e.g. factoring, polynomial identities, graph colouring, etc. NP-completeness.

dreama
Download Presentation

NP-completeness

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. NP-completeness Lecture 2: Jan 11

  2. P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many problems that we don’t know how to solve in polynomial time. e.g. factoring, polynomial identities, graph colouring, etc.

  3. NP-completeness

  4. NP-completeness

  5. NP-completeness

  6. Polynomial Time Reduction How to show that a problem R is not easier than a problem Q? Informally, if R can be solved efficiently, we can solve Q efficiently. • Formally, we say Q polynomially reduces to R if: • Given an instance q of problem Q • There is a polynomial time transformation to an instance f(q) of R • q is a “yes” instance if and only if f(q) is a “yes” instance Then, if R is polynomial time solvable, then Q is polynomial time solvable. If Q is not polynomial time solvable, then R is not polynomial time solvable.

  7. First Example Clique: a subset of vertices S so that for every two vertices u,v in S are joined by an edge. Instance: A graph G=(V,E) and a positive integer k. Question: Is there a clique of size k or more for G? Independent set: a subset of vertices S so that for every two vertices u,v in S are joined by an edge. Instance: A graph G=(V,E) and a positive integer k. Question: Is there an independent of size k or more for G?

  8. First Example Instance: A set X and a size s(x) for each x in X. Question: Is there a subset X’ X such that PARTITION SUBSET-SUM Instance: A set X and a size s(x) for each x in X, and an integer B. Question: Is there a subset X’ X such that

  9. First Example HAMILTONIAN CYCLE Instance: A graph G=(V,E). Question: Does G contains a Hamiltonian cycle, i.e. a cycle which visits every vertex exactly once? HAMILTONIAN PATH Instance: A graph G=(V,E). Question: Does G contains a Hamiltonian path, i.e. a path which visits every vertex exactly once?

  10. NP NP (Non-deterministic polynomial time): A class of decision problems whose solutions can be “verified” in polynomial time. For each “yes” instance, there is a proof that can be checked in polynomial time. • Two equivalent definitions: • Given a solution, we can check in polynomial time whether it is correct. • There is a non-deterministic algorithm (a magic algorithm) that can • guess the solution and check if it is correct in polynomial time. P is the class of problems that we can find a solution in polynomial time.

  11. Cook’s Theorem Satisfiability (SAT) Instance: A set of boolean variables and a set of clauses. Question: Is there a truth assignment that satisfies all the clauses? (Cook 1970) If one can solve satisfiability in polynomial time, then one can solve all problems in NP in polynomial time.

  12. NP-completeness A problem Q is NP-complete if Q is in NP, and if Q can be solved in polynomial time => every problem in NP can be solved in polynomial time. Then Q is the “hardest” problem in NP. Cook’s theorem (1970): SAT is NP-complete. • To show a problem Q is NP-complete: • show that Q is in NP • show that an NPc problem <= Q

  13. 3-SAT Instance: Collection C = {c1, c2, …, cm} of clauses on a set U of variables such that |ci| = 3 for all 1 <= i <= m. Question: Is there a truth assignment for U that satisfies all the clauses in C? SAT <= 3SAT

  14. Vertex Cover Vertex cover: a subset of vertices S so that for every edge (u,v), at least one of u and v belongs to S. Instance: A graph G=(V,E) and a positive integer k. Question: Is there a vertex cover of size k or less for G? 3SAT <= VERTEX COVER

  15. Clique Clique: a subset of vertices S so that for every two vertices u,v in S are joined by an edge. Instance: A graph G=(V,E) and a positive integer k. Question: Is there a clique of size k or more for G? VERTEX COVER <= CLIQUE

  16. 3D Matching Instance: A set M W x X x Y, where W, X, and Y are disjoint sets having the same number q of elements. Question: Does M contains a matching, a subset M’ M such that |M’|=q and no two elements of M’ agree in any coordinate? 3SAT <= 3DM

  17. Partition Instance: A set X and a size s(x) for each x in X. Question: Is there a subset X’ X such that 3DM <= PARTITION

  18. Hamiltonia Cycle Instance: A graph G=(V,E). Question: Does G contains a Hamiltonian cycle, i.e. a cycle which visits every vertex exactly once? VERTEX COVER <= HAMILTONIAN CYCLE

  19. Techniques • Restriction • Show that a special case is already NP-complete. • Local replacement • Replace each basic unit by a different structure. • Component design • Design “components” with specific functionality.

  20. Minimum Cover Instance: Collection C of subsets of a set S, and a positive integer k. Question: Does C contains a cover for S of size k or less, that is, a subset C’ C with |C’| <= k and ? 3DM <= Minimum Cover

  21. Subgraph Isomorphism Two graphs G1 = (V1,E1) and G2 = (V2,E2) are isomorphic if bijectionf: V1 →V2 u —v inE1iff f (u)—f (v)inE2 Instance: Two graphs G = (V1,E1) and H = (V2,E2). Question: Does G contain a subgraph isomorphic to H? Clique <= Subgraph Isomorphism

  22. Bounded Degree Spanning Tree A spanning tree is a connected subgraph with |V|-1 edges. Instance: A graph G=(V,E) and a positive integer k. Question: Is there a spanning tree for G in which no vertex has degree > k? Hamiltonian path <= Bounded degree spanning tree

  23. Partition into Triangles Instance: A graph G=(V,E) with |V|=3q vertices. Question: Is there a partition of V into q disjoint sets V1, V2, …, Vq of three vertices so that each Vi is a triangle? 3DM <= Partition into Triangles

  24. Sequencing within Intervals Instance: A set T of jobs, each has a release time r(t), a deadline d(t) and a length l(t). Question: Does there exist a feasible schedule for T? Partition <= Sequencing within Intervals

  25. Open Problems Graph Isomorphism Instance: Two graphs G = (V1,E1) and H = (V2,E2). Question: Is G isomorphic to H? Composite Number Instance: Given a number k. Question: Is k = p x q for p > 1 and q > 1?

  26. Conclusion Why people believe that P NP? I can appreciate good music (being able to verify solutions) doesn’t mean that I can compose good music (to find solutions). (from wikipedia) "Proof by contradiction. Assume P = NP. Let y be a proof that P = NP. The proof y can be verified in polynomial time by a competent computer scientist, the existence of which we assert. However, since P = NP, the proof y can be generated in polynomial time by such computer scientists. Since this generation has not yet occurred (despite attempts by such computer scientists to produce a proof), we have a contradiction." http://www.claymath.org/millennium/P_vs_NP/

More Related