Lec27 Nphard
Lec27 Nphard
Section 8.1
1
Computational Complexity
I We’ve seen algorithms for lots of problems, and the goal was
always to design an algorithm that ran in polynomial time.
2
Decision Problems
Decision Problems:
3
Decision is no harder than Optimization
The decision version of a problem is easier than (or the same as)
the optimization version.
Why, for example, is this true of, say, Max Flow: “Is there a flow
of value at least C ?”
Decision is no harder than Optimization
The decision version of a problem is easier than (or the same as)
the optimization version.
Why, for example, is this true of, say, Max Flow: “Is there a flow
of value at least C ?”
u1 , v1 , c1 ; u2 , v2 , c2 ; u3 , v3 , c3 ; ; s, t
More explicitly,
1,10,5;3,7,20;12,15,1;;10
5
Encoding an Instance
We can encode an instance of a decision problem as a string.
u1 , v1 , c1 ; u2 , v2 , c2 ; u3 , v3 , c3 ; ; s, t
More explicitly,
1,10,5;3,7,20;12,15,1;;10
5
Decision Problems and Languages
A decision problem X is really just sets of strings:
String ∈ X?
1,10,5;3,7,20;12,15,1;;1;12 Yes
1,10,5;3,7,20;12,15,1;;1;200 No
.. ..
. .
7
A Model of Computation
Ultimately, we want to say that “a computer can’t recognize some
language efficiently.”
Read/write
head
9
The class P
P is the set of languages whose memberships are decidable by a
Turing Machine that makes a polynomial number of steps.
From now on, you can just think of your normal computer as a
Turing Machine — and we won’t worry too much about that
formalism.
10
The Class NP
11
Certificates
Recall the independent set problem (decision version):
12
Efficient Certification
Def. An algorithm B is an efficient certifier for problem X if:
13
The class NP
Certificate C
Certificate is
magically guessed
B
15
P ⊆ NP
Theorem. P ⊆ NP
P= NP?
17
How do we prove a problem is probably hard?
18
Reductions as tool for hardness
We want prove some problems are computationally difficult.
19
We’ve Seen Reductions Before
Examples of Reductions:
20
Polynomial Reductions
I If problem Y can be reduced to problem X , we denote this by
Y ≤P X .
21
Polynomial Problems
Suppose:
I Y ≤P X , and
Why?
Polynomial Problems
Suppose:
I Y ≤P X , and
Call X
Reductions for Hardness
23
Vertex Cover
24
Independent Set to Vertex Cover
25
Relation btwn Vertex Cover and Indep. Set
26
Independent Set ≤P Vertex Cover
Independent Set ≤P Vertex Cover
28
NP-completeness
29
NP-completeness and P=NP
30
Reductions and NP-completeness
1. X is in NP
2. Y ≤P X
then X is NP-complete.
31
Some First NP-complete problem
32
Set Cover
Another very general and useful covering problem:
Set Cover ∈ NP
Vertex Cover ≤P Set Cover
33
Set Cover, Figure
34
Set Cover, Figure
35
Vertex Cover ≤P Set Cover
Thm. Vertex Cover ≤P Set Cover
I U=E
I Create a Su for for each u ∈ V , where Su contains the edges
adjacent to u.
37
Summary
You can prove a problem is NP-complete by reducing a known
NP-complete problem to it.
I Vertex Cover
I Independent Set
I Set Cover
38