39
Lecture 6 NP Class

Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Embed Size (px)

Citation preview

Page 1: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Lecture 6 NP Class

Page 2: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

P = ? NP = ? PSPACE

• They are central problems in computational complexity.

Page 3: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

If P = NP, then

NP-completeP

Page 4: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Ladner Theorem

• If NP ≠ P, then there exists a set A lying -between P and NP-complete class, i.e., A is in NP, but not in P and not being NP-compete.

Page 5: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Is it true that

a problem belongs to NP iffits solution can be polynomial-time verified

?

Answer: No!

Page 6: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Integer Programming

integer.an is

0

s.t.

max

i

T

x

x

bAx

xc

Page 7: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Decision version of Integer Programming

.0

and

satisfy vector

integeran thereis , and ,,Given

0

0

x

bAx

cxc

x

cbAc

T

Page 8: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

.in

gprogrammininteger ofersion decision v

for proof legal anot is thisHowever,

.|| respect to with time

polynomialin esinequaliti osesatisfy th

ether verify wheasy to isit ,Given

NP

x

xx

Page 9: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

How to prove a decision problem belonging to NP?

How to design a polynomial-time nondeterministic algorithm?

Page 10: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Hamiltonian Cycle

• Given a graph G, does G contain a Hamiltonian cycle?

• Hamiltonian cycle is a cycle passing every vertex exactly once.

Page 11: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Post office

Page 12: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Nondeterministic Algorithm

• Guess a permutation of all vertices.

• Check whether this permutation gives a cycle. If yes, then algorithm halts.

What is the running time?

Page 13: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Minimum Spanning Tree

• Given an edge-weighted graph G, find a spanning tree with minimum total weight.

• Decision Version: Given an edge-weighted graph G and a positive integer k, does G contains a spanning tree with total weight < k.

Page 14: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Nondeterministic Algorithm

• Guess a spanning tree T.

• Check whether the total weight of T < k.

This is not clear!

Page 15: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

How to guess a spanning tree?

• Guess n-1 edges where n is the number of vertices of G.

• Check whether those n-1 edges form a connected spanning subgraph, i.e., there is a path between every pair of vertices.

Page 16: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Co-decision version of MST

• Given an edge-weighted graph G and a positive integer k, does G contain no spanning tree with total weight < k?

Page 17: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Algorithm

• Computer a minimum spanning tree.

• Check whether its weight > k. If yes, the algorithm halts.

Page 18: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

co-NP

• co-NP = {A | Σ* - A ε NP}

Page 19: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

NP ∩ co-NP

So far, no natural problem has been found in NP ∩ co-NP, but not in P.

P

NP

co-NP

Page 20: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Linear Programming

• Decision version: Given a system of linear inequality, does the system have a solution?

• It was first proved in NP ∩ co-NP and later found in P (1979).

Page 21: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Primality Test

• Given a natural number n, is n a prime?

• It was first proved in NP ∩ co-NP and later found in P (2004).

Page 22: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Therefore

• A natural problem belonging to NP ∩ co-NP is a big sign for the problem belonging to P.

Page 23: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Proving a problem in NP

• In many cases, it is not hard.

• In a few cases, it is not easy.

Page 24: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Integer Programming

• Decision version: Given A and b, does Ax > b contains an integer solution?

• The difficulty is that the domain of “guess” is too large.

Page 25: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Polynomial-time many-one

reduction

Page 26: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

A < m B

• A set A in Σ* is said to be polynomial-time many-one reducible to B in Γ* if there exists a polynomial-time computable function f: Σ* → Γ* such that

x ε A iff f(x) ε B.

p

Page 27: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

A = Hamiltonian cycle (HC)

• Given a graph G, does G contain a Hamiltonian cycle?

Page 28: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

B = decision version of Traveling Salesman Problem (TSP)

• Given n cities and a distance table between these n cities, find a tour (starting from a city and come back to start point passing through each city exactly once) with minimum total length.

• Given n cities, a distance table and k > 0,

does there exist a tour with total length < k?

Page 29: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

HC < m TSP

• From a given graph G, we need to construct (n cities, a distance table, k).

p

Page 30: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

. formulaBoolean CNF3

3

FF

SATSAT pm

Page 31: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

SAT < m 3-SAT

• SAT: Given a Boolean formula F, does F have a satisfied assignment?

• An assignment is satisfied if it makes F =1.

• 3-SAT: Given a 3-CNF F, does F have a satisfied assignment?

p

Page 32: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

),,(

))()()((

))(()(

1)(

yxwp

yxwyxwyxwyxw

wyxyxwyxwyxw

yxwyxwyxw

))()()((

),,(

1),,(

yxwyxwyxwyxw

yxwq

yxwqyxwxyw

Page 33: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

. '),,(

Then '.in results

variablenew aby replacing case,1st In the

. '),,(

Then '.in results

variablenew aby replacing case,1st In the

literals. twoare and whereor

termacontain must formulaBoolean Every

SATFSATFyxwp

Fw

yx

SATFSATFyxwq

Fw

xy

yxyxxy

F

Page 34: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

1))()()((

1

vuwvuwvuwvuw

w

Page 35: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Property of < m

• A < m B and B < m C imply A < m C

• A < m B and B ε P imply A ε P

p

p p p

p

Page 36: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

NP-complete

• A set A is NP-hard if for any B in NP,

B < m A.

• A set A is NP-complete if it is in NP and NP-hard.

• A decision problem is NP-complete if its corresponding language is NP-complete.

• An optimization problem is NP-hard if its decision version is NP-hard.

p

Page 37: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Characterization of NP

].,))[(||,(

,|| with for

such that polynomail a and aexist there

ByxnpyyAx

nxx

pPBNPA

:zationcharacteri thisusemay we,reduction construct To SATA pm

].,))[(||}*,1,0{(

,|| with for

such that polynomail a and aexist there

ByxnpyyAx

nxx

pPBNPA

Page 38: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

state.) final ain is or

move one through from obtained is (i.e., (c)

state). final ain (i.e.,ion configurat final a is (b)

ion.configurat intial theis (a)

: trueare following the, Now,

)].(|),(|))[(||,()||,(

that satisfying polynomial afor )( where

,...,, ionsconfigurat of consisting moves, )(within

ofn computatio heconsider t ,|| with for ,input On

. bound timepolynomail a with DTM afor )( Suppose

1

11

0

10

ii

iiii

m

m

Byx

nryxqnpyynxx

rnrm

nr

Mnxxyx

qMMLB

Page 39: Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity

Thanks, end