CS 580 Algorithm Design and Analysis: NP and NP-completeness
CS 580 Algorithm Design and Analysis: NP and NP-completeness
580
ALGORITHM DESIGN AND ANALYSIS
NP and NP-completeness
Vassilis Zikas
SO FAR
• Today:
◦ The class NP! (8.3 in KT)
◦ NP-completeness
◦ co-NP
MORE REDUCTION STRATEGIES
• Decision problem:
◦ Does there exist a vertex cover of size ≤ F?
• Search problem:
◦ Find the vertex cover of minimum cardinality
• Self-reducibility:
◦ Search version ≤) decision version
◦ Applies to all NP-complete problems
◦ Justifies our focus on decision problems
MORE REDUCTION STRATEGIES
Grade school
MULTIPLE Is x a multiple of y? 51, 17 51, 16
division
RELPRIME Are x and y relatively prime? Euclid (300 BCE) 34, 39 34, 51
é 0 1 1ù é 4 ù é 1 0 0 ù é1ù
Is there a vector x that Gauss-Edmonds
LSOLVE ê ú ê ú
ê 2 4 -2 ú , ê 2 ú
ê ú ê ú
ê 1 1 1ú , ê1ú
satisfies Ax = b? elimination êë 0 3 15 úû êë36 úû êë0 1 1úû êë1ûú
CERTIFICATES
• Finding a solution versus checking a solution
• We do not know good algorithms that decide
whether a CNF formula is satisfiable
• But, given a proposed solution we can quickly
check if it satisfies the formula or not
• Given a CNF formula one can provide evidence
that the formula is satisfiable
◦ Evidence = satisfying assignment
• What evidence is there that a formula is not
satisfiable?
• Formalizing “evidence” is going to be crucial
for us
CERTIFIER
• Example:
( x1 Ú x2 Ú x3 ) Ù ( x1 Ú x2 Ú x3 ) Ù ( x1 Ú x2 Ú x4 ) Ù (x1 Ú x3 Ú x4 )
Certificate *: x1 = 1, x2 = 1, x3 = 0, x4 = 1
• Conclusion: SAT is in NP
CERTIFIERS AND CERTIFICATES:
HAMILTON CYCLE
• HAM-CYCLE: Given an undirected graph K, does there exist a
simple cycle M that visits every node?
• Certificate: Ordered list of nodes
• Certifier: Check that the ordered list contains each node in Q
exactly once, and that there is an edge between adjacent nodes
in the list (and between the first and last node).
• Conclusion: HAM-CYCLE in NP
instance s certificate t
P, NP, EXP
• P: Decision problems for which there is poly-time algorithm
• NP: Decision problems for which there is a poly-time certifier
• EXP: Decision problems for which there is an exponential time
algorithm
• Claim: Z ⊆ \Z
◦ Proof: Consider any problem F in P
◦ By definition, there exists a poly-time algorithm J(L) that solves F
◦ Certificate N = ∅, certifier Q L, N = J(L)
• Claim: \Z ⊆ ]0Z
◦ Proof: Consider any problem F in NP
◦ By definition, there exists a poly-time certifier Q(L, N) for F
◦ To solve input L, run Q(L, N) on all strings N with N ≤ U( L )
◦ Return WXL if Q(L, N) returns WXL for any of these
THE QUESTION
EXP NP EXP
P P = NP
If P ¹ NP If P = NP
P VERSUS NP
¬ Ù
yes: 1 0 1 Ù Ú Ú
1 0 ? ? ?
v w
Ù Ù Ù
• Proof (continued):
◦ Hard-coded input and output values
• $- = 0 → add clause $-
• $. = 1 → add clause ($.)
output
x0
Ù
x1 x2 !! ∧ (!" ∨ !# ) ∧ (!" ∨ !! ) ∧ (!" ∨ !# ∨ !! ) ∧(!$ ∨
Ú ¬ !% ) ∧ !$ ∨ !% ∧(!" ∨ !& ) ∧ (!$ ∨ !& ) ∧ (!& ∨ !" ∨ !$ )
x5 x4 x3
0 ? ?
NP-COMPLETENESS
• Observation. All problems below are NP-complete
and polynomial reduce to one another!
CIRCUIT-SAT
3-SAT
to
du ces SET
re EN T
AT D
3-S DEPEN
IN