Download presentation

Presentation is loading. Please wait.

Published byMiranda Hoyt Modified over 3 years ago

1
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!)

2
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.

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

4
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.

5
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

6
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.

7
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

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

9
Can you order the same appetizer more than once?

10
SUBSET-SUM is in NP

11
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!

12
Transform Goal

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

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

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

16
x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y1 100 10 z1z1 100 01 y2y2 010 01 z2z2 010 10 ylyl 000 1 zlzl 000 1 t 111 1 Variables S Clauses We need to make at least one term in each clause true!

17
x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y1 100 10 z1z1 100 01 y2y2 010 01 z2z2 010 10 ylyl 000 1 zlzl 000 1 t 111 11111 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!

18
x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y1 100 10 z1z1 100 01 y2y2 010 01 z2z2 010 10 ylyl 000 1 zlzl 000 1 ff 1 100...0 fff 1 100...0 ff 2 010...0 fff 2 010...0 00 t 111 1 Variables S Clauses Select true/false for each Fudge factors

19
x1x1 x2x2 x3x3... xlxl c1c1 c2c2 c3c3 ckck y1y1 100 10 z1z1 100 01 y2y2 010 01 z2z2 010 10 ylyl 000 1 zlzl 000 1 ff 1 100...0 fff 1 100...0 ff 2 010...0 fff 2 010...0 00 t 111 133333 Variables S Clauses Select true/false for each Fudge factors

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

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

22
Reject Solutions involve multiple orders of the same appetizer.

23
Knapsack

24
KNAPSACK is in NP

25
Example

26
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?

27
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

28
Input Transformation

29
S = { 102.15, 1002.75, 10003.35, 100003.55, 1000004.20, 1000005.80, 100.00, 1000.00, 10000.00, 100000.00, 1000000.00, 1000000.00 } t = 11111115.05 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.

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

31
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

32
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 1969-73): Universal search problems Cook-Levin Theorem: SAT is NP-Complete

33
Stephen CookLeonid Levin

34
(Pre)-History of P=NP

35
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

36
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

37
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).”

38
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.

39
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. …

40
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…

41
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!)

Similar presentations

OK

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.

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.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on content addressable memory applications Ppt on higher education system in india Presenter media free download ppt on pollution Ppt on cross docking charges Ppt on mobile number portability Ppt on quality control in industrial management Ppt on rural development schemes in india Ppt on condition monitoring vibration Resource based view ppt online Ppt on principles of management for class 12