Cs3102: Theory of Computation Class 25: NP-Complete Appetizers Spring 2010 University of Virginia David Evans PS6 is due Tuesday, April 27 (but don’t wait.

Slides:



Advertisements
Similar presentations
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
Advertisements

NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Lecture 21 NP-complete problems
The Theory of NP-Completeness
Great Theoretical Ideas in Computer Science for Some.
Discrete Structures & Algorithms The P vs. NP Question EECE 320.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
CS21 Decidability and Tractability
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
Graphs 4/16/2017 8:41 PM NP-Completeness.
NP-complete and NP-hard problems
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Chapter 11: Limitations of Algorithmic Power
Black-box (oracle) Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Efficient.
Great Theoretical Ideas in Computer Science.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSCI 2670 Introduction to Theory of Computing December 1, 2004.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
COMPSCI 102 Introduction to Discrete Mathematics.
Class 24: P=NP? David Evans cs302: Theory of Computation University of Virginia Computer Science PS6 (the last one) is.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong The Cook-Levin.
1 How to establish NP-hardness Lemma: If L 1 is NP-hard and L 1 ≤ L 2 then L 2 is NP-hard.
1 Security through complexity Ana Nora Sovarel. 2 Projects Please fill one slot on the signup sheet. One meeting for each group. All members must agree.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
David Evans Class 15: P vs. NP (Smiley Puzzles and Curing Cancer) CS150: Computer Science University of Virginia Computer.
1 CSE 326: Data Structures: Graphs Lecture 24: Friday, March 7 th, 2003.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 8: Crash Course in Computational Complexity.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
NP-Completeness Note. Some illustrations are taken from (KT) Kleinberg and Tardos. Algorithm Design (DPV)Dasgupta, Papadimitriou, and Vazirani. Algorithms.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 23: Intractable Problems (Smiley Puzzles.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
1 SAT SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true?
Great Theoretical Ideas in Computer Science.
P, NP, NP-completeness 2 Reductions 1 Thu, July 7 th 1.
The NP class. NP-completeness
Computational Complexity Theory
Richard Anderson Lecture 26 NP-Completeness
Efficient computation
NP-completeness The Chinese University of Hong Kong Fall 2008
Class 24: Computability Halting Problems Hockey Team Logo
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Presentation transcript:

cs3102: Theory of Computation Class 25: NP-Complete Appetizers Spring 2010 University of Virginia David Evans PS6 is due Tuesday, April 27 (but don’t wait until then to start PS7!)

Recap To prove B is in NP-Hard, show that some known NP-Hard problem can be reduced to B. 3SAT  NP-Hard X NP B A problem/language is in NP, if there is a certificate that allows you to verify the answer in polynomial time. A problem/language is NP ‑ Hard if every problem in NP can be reduced to it. If a problem is in NP and NP ‑ Hard, it is in NP ‑ Complete.

Today’s Menu NP-Hardness Reduction Proofs SAT Subset Sum Knapsack (Pre-)History of P = NP Question

SATisfiability Is SAT in NP? Yes, the variable assignments are a polynomial-time verifiable certificate. Yes, the variable assignments are a polynomial-time verifiable certificate.

SAT is NP-Complete To prove SAT is in NP- Hard, show that some known NP-Hard problem can be reduced to SAT. 3SAT NP SAT 3SAT  NP-Hard Assume this is already known

Proof: SAT is NP-Complete M SAT Polynomial-time decider for SAT 3SAT input Polynomial- time Input Transformer Poly-time Output Transformer 3SAT output If we can use M SAT, a polynomial-time decider for SAT to build a polynomial- time decider for 3SAT, this proves that SAT is at least as “hard” as 3SAT. Show that if SAT is in P, so is 3SAT.

Proof: SAT is NP-Complete M SAT Polynomial-time decider for SAT 3SAT input 3SAT output Show that if SAT is in P, so is 3SAT. Identify transform: 3SAT input is a valid SAT input Identify transform: SAT output is correct 3SAT output

Subset Sum Language How many test of SUBSET-SUM do we to solve the subset sum search problem?

Can you order the same appetizer more than once?

SUBSET-SUM is in NP

SUBSET-SUM is in NP-Hard M SS Polynomial-time decider for SUBSET-SUM 3SAT input Polynomial- time Input Transformer Poly-time Output Transformer 3SAT output To finish the proof, we need to describe the transformers!

Transform Goal

Transform Idea x1x1 x2x2 x3x3... y1y1 100 z1z1 100 y2y2 010 z2z2 010 y3y3 001 z3z3 001

x1x1 x2x2 x3x3 xlxl y1y1 100 z1z1 100 y2y2 010 z2z2 010 ylyl zlzl t Variables S

x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y1 100 z1z1 100 y2y2 010 z2z2 010 ylyl zlzl t Variables S Clauses

x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y z1z y2y z2z ylyl zlzl t Variables S Clauses We need to make at least one term in each clause true!

x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y z1z y2y z2z ylyl zlzl t Variables S Clauses We need to make at least one term in each clause true! Doesn’t work: more than one term in a clause can be true!

x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y z1z y2y z2z ylyl zlzl ff fff ff fff t Variables S Clauses Select true/false for each Fudge factors

x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y z1z y2y z2z ylyl zlzl ff fff ff fff t Variables S Clauses Select true/false for each Fudge factors

x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 clcl y1y1 100 z1z1 100 y2y2 010 z2z2 010 y3y3 001 z3z3 001 ylyl zlzl Variables

3SAT reduces to SUBSET-SUM M SS Polynomial-time decider for SUBSET-SUM 3SAT input Polynomial- time Input Transformer Identity 3SAT output

Reject Solutions involve multiple orders of the same appetizer.

Knapsack

KNAPSACK is in NP

Example

Is KNAPSACK in NP-Hard? M SS Polynomial-time decider for KNAPSACK 3SAT input Polynomial- time Input Transformer Output transformer 3SAT output Could prove by reducing 3SAT to KNAPSACK. Any easier way?

Is KNAPSACK in NP-Hard? M SS Polynomial-time decider for KNAPSACK SUBSET-SUM input Polynomial- time Input Transformer Output transformer SUBSET-SUM output Prove by reducing SUBSET-SUM to KNAPSACK

Input Transformation

S = { , , , , , , , , , , , } t = Opps! Iit was pointed out in class that this doesn’t work since the KNAPSACK solver might include 10x or 100x of one of the numbers and still get the right sum. This should be fixable…if you can fix it, a good answer replaces Problem 5 on PS6.

Chain of Reductions KNAPSACK SUBSET-SUM 3SAT reduces to Every problem in NP reduces to

Hints for PS6, Problem 5 Prove Genome Assembly is NP-Complete Solve this by thinking, not googling You can (of course!) do the reduction from any NP-Complete problem to Genome Assembly – But, some will be easier than others – Some of the problems described in Sipser are better choices than ones we have covered in class

History of P = NP Stephen Cook (US, 1971): The complexity of theorem proving procedures Richard Karp (US 1972): List of 21 NP-Complete problems Leonid Levin (USSR ): Universal search problems Cook-Levin Theorem: SAT is NP-Complete

Stephen CookLeonid Levin

(Pre)-History of P=NP

Princeton, 20 March 1956 Dear Mr. von Neumann: With the greatest sorrow I have learned of your illness. … I hope and wish for you that your condition will soon improve even more and that the newest medical discoveries, if possible, will lead to a complete recovery. Since you now, as I hear, are feeling stronger, I would like to allow myself to write you about a mathematical problem, of which your opinion would very much interest me: One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. Namely, it would obviously mean that inspite of the undecidability of the Entscheidungsproblem, the mental work of a mathematician concerning Yes-or-No questions could be completely replaced by a machine. After all, one would simply have to choose the natural number n so large that when the machine does not deliver a result, it makes no sense to think more about the problem. Princeton, 20 March 1956 Dear Mr. von Neumann: With the greatest sorrow I have learned of your illness. … I hope and wish for you that your condition will soon improve even more and that the newest medical discoveries, if possible, will lead to a complete recovery. Since you now, as I hear, are feeling stronger, I would like to allow myself to write you about a mathematical problem, of which your opinion would very much interest me: One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. Namely, it would obviously mean that inspite of the undecidability of the Entscheidungsproblem, the mental work of a mathematician concerning Yes-or-No questions could be completely replaced by a machine. After all, one would simply have to choose the natural number n so large that when the machine does not deliver a result, it makes no sense to think more about the problem. Gödel’s 1956 Letter (Translated)Translated

Princeton, 20 March 1956 Dear Mr. von Neumann: With the greatest sorrow I have learned of your illness. … I hope and wish for you that your condition will soon improve even more and that the newest medical discoveries, if possible, will lead to a complete recovery. Since you now, as I hear, are feeling stronger, I would like to allow myself to write you about a mathematical problem, of which your opinion would very much interest me: One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. Namely, it would obviously mean that inspite of the undecidability of the Entscheidungsproblem, the mental work of a mathematician concerning Yes-or-No questions could be completely replaced by a machine. After all, one would simply have to choose the natural number n so large that when the machine does not deliver a result, it makes no sense to think more about the problem. Princeton, 20 March 1956 Dear Mr. von Neumann: With the greatest sorrow I have learned of your illness. … I hope and wish for you that your condition will soon improve even more and that the newest medical discoveries, if possible, will lead to a complete recovery. Since you now, as I hear, are feeling stronger, I would like to allow myself to write you about a mathematical problem, of which your opinion would very much interest me: One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. Namely, it would obviously mean that inspite of the undecidability of the Entscheidungsproblem, the mental work of a mathematician concerning Yes-or-No questions could be completely replaced by a machine. After all, one would simply have to choose the natural number n so large that when the machine does not deliver a result, it makes no sense to think more about the problem. Gödel’s 1956 Letter (Translated)Translated

Has-Short-Proof “One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols).”

Has Short Proof is Decidable Try all possible proofs of length  n – How do we know this is finite? For each possible proof, check if it is a valid proof of F. – A proof is valid if: It starts from the accepted axioms. Each step follows a deduction rule (finite set of rules). It reaches the statement F.

Princeton, 20 March 1956 Dear Mr. von Neumann: … One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. … Princeton, 20 March 1956 Dear Mr. von Neumann: … One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. …

Princeton, 20 March 1956 Dear Mr. von Neumann: … One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. … Princeton, 20 March 1956 Dear Mr. von Neumann: … One can obviously easily construct a Turing machine, which for every formula F in first order predicate logic and every natural number n, allows one to decide if there is a proof of F of length n (length = number of symbols). Let ψ(F,n) be the number of steps the machine requires for this and let ϕ(n) = max F ψ(F, n). The question is how fast ϕ(n) grows for an optimal machine. One can show that ϕ(n) ≥ k ⋅ n. If there really were a machine with ϕ(n) ∼ k ⋅ n (or even ∼ k ⋅ n 2 ), this would have consequences of the greatest importance. … Let’s give Gödel the benefit of the doubt, and read this as, “(or even ∼ kn 2, ∼ kn 3, ∼ kn 4,... )” We’ll continue with this Tuesday…

Charge NP-Complete problems are everywhere! Route planning, scheduling courses, matching medical students, register allocation, pancakes, sudoko, protein folding, soap bubbles, March madness,... Route planningscheduling coursesmatching medical studentsregister allocation pancakessudokoprotein foldingsoap bubblesMarch madness Next week – When we want problems to be hard – Computing with photons and DNA PS6 is due Tuesday, April 27 (but don’t wait until then to start PS7!)