Slides23 - NPblerner/cs312/Slides/Slides23.pdf · 2019-04-29 · 51, 17 51, 16 RELPRIME Are x and y...
Transcript of Slides23 - NPblerner/cs312/Slides/Slides23.pdf · 2019-04-29 · 51, 17 51, 16 RELPRIME Are x and y...
End of Year Celebration!!
Thursday, May 2, 12:00
1-1
End of Year Celebration!!
Thursday, May 2, 12:00
Gabi1-2
End of Year Celebration!!
Thursday, May 2, 12:00
Gabi
Emilyann
1-3
Slides23 - NP.key - April 26, 2019
Practically solvable?
Yes Probably no
Shortest path Longest path
Min cut Max cut
2-SAT 3-SAT
Bipartite vertex cover Vertex cover
Primality testing Factoring
2
Classify problems according to relative difficulty.
Design algorithms. If Y ≤ P X and X can be solved in polynomial-time, then Y can also be solved in polynomial time.
Establish intractability. If Y ≤ P X and Y cannot be solved in polynomial-time, then X cannot be solved in polynomial time.
Establish equivalence. If X ≤ P Y and Y ≤ P X, we use notation X ≡ P Y.
Polynomial-Time Reduction3-1
Today’s Focus
Classify problems according to relative difficulty.
Design algorithms. If Y ≤ P X and X can be solved in polynomial-time, then Y can also be solved in polynomial time.
Establish intractability. If Y ≤ P X and Y cannot be solved in polynomial-time, then X cannot be solved in polynomial time.
Establish equivalence. If X ≤ P Y and Y ≤ P X, we use notation X ≡ P Y.
Polynomial-Time Reduction3-2
Slides23 - NP.key - April 26, 2019
Self-Reducibility
Decision problem. Does there exist a vertex cover of size ≤ k?
Search problem. Find vertex cover of minimum cardinality.
Self-reducibility. Search problem ≤ P decision version.Applies to all (NP-complete) problems in this chapter.Justifies our focus on decision problems.
4
Definition of PP: Decision problems for which there is a polynomial algorithm.
Problem Description Algorithm Yes No
MULTIPLE Is x a multiple of y?Grade school
division 51, 17 51, 16
RELPRIME Are x and y relatively prime?
Euclid (300 BCE) 34, 39 34, 51
PRIMES Is x prime? AKS (2002) 53 51
EDIT-DISTANCE
Is the edit distance between x and y less than
5?
Dynamic programming
niether neither
acgggt ttttta
5
P, NP
P. Decision problems for which there is a polynomial time algorithm.
NP. Decision problems for which there is a polynomial time certifier.
6
Slides23 - NP.key - April 26, 2019
Solving vs. CertifyingConsider the independent set problem:
Solving => Find an independent set of size k for a graph G indep-set = SolveIndependentSet (G, k)
Certifying => Given a graph G and a set, certify whether the set is an independent set of size k is-independent = CertifyIndependentSet (G, k, indep-set)
No known polynomial time solution to solve independent setA purported solution to independent set can be certified in polynomial time
7
Certifiers and Certificates: Non-Prime
COMPOSITES. Given an integer s, is s non-prime?
Certificate. A nontrivial factor t of s. Note that such a certificate exists iff s is non-prime. Moreover t ≤ s.
Certifier:
boolean C(s, t) { if (t ≤ 1 or t ≥ s) return false else if (s is a multiple of t) return true else return false }
Instance: s = 437,669.
Certificate: t = 541 or 809.
8
Certifiers and Certificates: 3-Satisfiability
SAT. Given a CNF formula, is there a satisfying assignment?
(x1 ⋁ x2 ⋁ x3) ⋀ (x1 ⋁ x2 ⋁ x3) ⋀ (x1 ⋁ x2 ⋁ x4) ⋀ (x1 ⋁ x3 ⋁ x4)
Certificate. An assignment of truth values to the n boolean variables.
x1 = true, x2 = true, x3 = false, x4 = true
Certifier. Check that each clause has at least one true literal.
9
Slides23 - NP.key - April 26, 2019
Certifiers and Certificates: Hamiltonian Cycle
HAM-CYCLE. Given an undirected graph G = (V, E), does there exist a simple cycle C that visits every node?
Certificate. A permutation of the n nodes.
instance s
10-1
Certifiers and Certificates: Hamiltonian Cycle
HAM-CYCLE. Given an undirected graph G = (V, E), does there exist a simple cycle C that visits every node?
Certificate. A permutation of the n nodes.
instance s
certificate t
10-2
P, NP
Claim. P ⊆ NP.
Proof. Consider any problem X in P.By definition, there exists a polynomial time algorithm A(s) that solves X.Certificate: t = ε, certifier C(s, t) = A(s). ▪
11
Slides23 - NP.key - April 26, 2019
The Main Question: P Versus NP
Does P = NP?
Is the decision problem as easy as the certification problem?
Clay $1 million prize.
If yes: Efficient algorithms for 3-SAT, vertex cover, …
If no: No efficient algorithms possible for 3-SAT, vertex cover, …
EXP NPP
EXPP = NP
12
“ The classes of problems which are respectively known and not known to have good algorithms are of great theoretical interest…. I conjecture that there is no good algorithm for the traveling salesman problem. My reasons are the same as for any mathematical conjecture:
(i) It is a legitimate mathematical possibility and (ii) I do not know.”
-- Jack Edmonds, 1966
13
The Simpson's: P = NP?
Copyright © 1990, Matt Groening
14
Slides23 - NP.key - April 26, 2019
NP-Complete
NP-complete. A problem Y in NP with the property that for every problem X in NP, X ≤ p Y.
Theorem. Suppose Y is an NP-complete problem. Then Y is solvable in polynomial time iff P = NP.
15
NP-Complete
Theorem. Suppose Y is an NP-complete problem. Then Y is solvable in polynomial time iff P = NP.
Proof of only-if part: If P = NP then Y can be solved in polynomial time since Y is in NP. Proof of if-part: Suppose Y can be solved in polynomial time.
Let X be any problem in NP. Since X ≤ p Y, we can solve X in polynomial time. This implies NP ⊆ P.We already know P ⊆ NP. Thus P = NP. ▪
Fundamental question. Do there exist "natural" NP-complete problems?
16
∧
¬
∧ ∨
∧
∨
1 0 ? ? ?
output
inputshard-coded inputs
Circuit SatisfiabilityCIRCUIT-SAT. Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1?
17-1
Slides23 - NP.key - April 26, 2019
∧
¬
∧ ∨
∧
∨
1 0 ? ? ?
output
inputshard-coded inputs
yes: 1 0 1
Circuit SatisfiabilityCIRCUIT-SAT. Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1?
17-2
All problems below are NP-complete and polynomial reduce to one another!
CIRCUIT-SAT
3-SAT
DIR-HAM-CYCLE
INDEPENDENT SET
VERTEX COVER
3-SAT re
duces to
INDEPENDENT SE
T
GRAPH 3-COLOR
HAM-CYCLE
TSP
SUBSET-SUM
SCHEDULINGPLANAR 3-COLOR
NP-Completeness
by definition of NP-completeness
SET COVER
18
Some NP-Complete ProblemsSix basic genres of NP-complete problems and paradigmatic examples.
Packing problems: SET-PACKING, INDEPENDENT SET.Covering problems: SET-COVER, VERTEX-COVER.Constraint satisfaction problems: SAT, 3-SAT.Sequencing problems: HAMILTONIAN-CYCLE, TSP.Partitioning problems: 3D-MATCHING 3-COLOR.Numerical problems: SUBSET-SUM, KNAPSACK.
Practice. Most NP problems are either known to be in P or NP-complete.
Notable exceptions. Factoring, graph isomorphism
19
Slides23 - NP.key - April 26, 2019
Extent and Impact of NP-Completeness
Extent of NP-completeness. Prime intellectual export of CS to other disciplines.6,000 citations per year (title, abstract, keywords).
more than "compiler", "operating system", "database"Broad applicability and classification power.
20
21-1
General solutions get you a 50% tip.
21-2
Slides23 - NP.key - April 26, 2019
More Hard Computational Problems
Aerospace engineering: optimal mesh partitioning for finite elements.Biology: protein folding.Chemical engineering: heat exchanger network synthesis.Civil engineering: equilibrium of urban traffic flow.Economics: computation of arbitrage in financial markets with friction.Electrical engineering: VLSI layout. Environmental engineering: optimal placement of contaminant sensors.Financial engineering: find minimum risk portfolio of given return.Game theory: find Nash equilibrium that maximizes social welfare.Genomics: phylogeny reconstruction.Mechanical engineering: structure of turbulence in sheared flows.Medicine: reconstructing 3-D shape from biplane angiocardiogram.Operations research: optimal resource allocation. Physics: partition function of 3-D Ising model in statistical mechanics.Politics: Shapley-Shubik voting power.Statistics: optimal experimental design.
22
Status of P = NP questionIn 1971, Stephen Cook wrote a paper that precisely formulated the problem
In 2000, it became one of the Millennium Prizes
August 8, 2010: Announcement of proof that P ≠ NP
August 10, 2010: Concluded not proven
Currently, computer scientists widely suspect that P ≠ NP, but there is no proof. If P = NP, public key cryptography, which all ecommerce
depends on, will be insecure.
23
Will it be on the exam? 24-1
Slides23 - NP.key - April 26, 2019
Will it be on the exam?The facts you should know for the exam:
24-2
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problem
24-3
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problemA problem is in NP if we can check a purported solution in polynomial time
24-4
Slides23 - NP.key - April 26, 2019
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problemA problem is in NP if we can check a purported solution in polynomial timeP ⊆ NP
24-5
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problemA problem is in NP if we can check a purported solution in polynomial timeP ⊆ NPNobody knows if P = NP or not
24-6
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problemA problem is in NP if we can check a purported solution in polynomial timeP ⊆ NPNobody knows if P = NP or notWhile it has not been proven, computer scientist believe that P ≠ NP.
24-7
Slides23 - NP.key - April 26, 2019
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problemA problem is in NP if we can check a purported solution in polynomial timeP ⊆ NPNobody knows if P = NP or notWhile it has not been proven, computer scientist believe that P ≠ NP.If P = NP, a large number of problems with no known polynomial time algorithms actually can be solved in polynomial time.
24-8
Will it be on the exam?The facts you should know for the exam:
A problem is in P if there is a polynomial time algorithm to solve the problemA problem is in NP if we can check a purported solution in polynomial timeP ⊆ NPNobody knows if P = NP or notWhile it has not been proven, computer scientist believe that P ≠ NP.If P = NP, a large number of problems with no known polynomial time algorithms actually can be solved in polynomial time.If P = NP, public key encryption, which is the basis for ecommerce, will no longer be secure
24-9
P = NP in Popular CultureIn 1995, the Simpsons Treehouse of Horror VI shows the P=NP equation when Homer enters the 3D universe
In a 2011 episode of Suits, two lawyers solve an NP-complete problem.
Traveling Salesman - a movie released in 2012 in which 4 mathematicians are hired by the US government to solve P=NP (presumably so they could break encryption)
A 2013 episode of Elementary is about a mathematician who is murdered who was trying to solve P=NP
25
Slides23 - NP.key - April 26, 2019