prof. busch - lsu1 more np-complete problems. prof. busch - lsu2 theorem: if: language is...

30
Prof. Busch - LSU 1 More NP-complete Problems

Upload: naomi-ramsey

Post on 05-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 1

More NP-complete Problems

Page 2: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 2

Theorem:

If: Language is NP-complete Language is in NP is polynomial time reducible to

A

A BB

Then: is NP-completeB

(proven in previous class)

Page 3: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 3

Using the previous theorem,we will prove that 2 problems are NP-complete:

Vertex-Cover

Hamiltonian-Path

Page 4: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 4

Vertex cover of a graph is a subset of nodes such that every edge in the graph touches one node in

Vertex Cover

SS

S = red nodes

Example:

Page 5: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 5

|S|=4Example:

Size of vertex-cover is the number of nodes in the cover

Page 6: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 6

graph contains a vertex cover of size }

VERTEX-COVER = { : kG,G

k

Corresponding language:

Example:G

COVER-VERTEX4, G

Page 7: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 7

Theorem:

1. VERTEX-COVER is in NP

2. We will reduce in polynomial time 3CNF-SAT to VERTEX-COVER

Can be easily proven

VERTEX-COVER is NP-complete

Proof:

(NP-complete)

Page 8: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 8

Let be a 3CNF formulawith variables and clauses

m

l

Example:

)()()( 431421321 xxxxxxxxx

4m

3l

Clause 1 Clause 2 Clause 3

Page 9: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 9

Formula can be converted to a graph such that:

G

is satisfied

if and only if

GContains a vertex coverof size lmk 2

Page 10: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 10

)()()( 431421321 xxxxxxxxx

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

Clause 1 Clause 2 Clause 3

Clause 1 Clause 2 Clause 3

Variable Gadgets

Clause Gadgets

m2 nodes

l3 nodes

Page 11: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 11

)()()( 431421321 xxxxxxxxx

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

Clause 1 Clause 2 Clause 3

Clause 1 Clause 2 Clause 3

Page 12: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 12

If is satisfied, then contains a vertex cover of size

G

lmk 2

First direction in proof:

Page 13: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 13

)()()( 431421321 xxxxxxxxx

Satisfying assignment1 0 0 1 4321 xxxx

Example:

We will show that contains a vertex cover of size

103242 lmk

G

Page 14: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 14

)()()( 431421321 xxxxxxxxx

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

1 0 0 1 4321 xxxx

Put every satisfying literal in the cover

Page 15: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 15

)()()( 431421321 xxxxxxxxx

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

1 0 0 1 4321 xxxx

Select one satisfying literal in each clause gadgetand include the remaining literals in the cover

Page 16: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 16

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

This is a vertex cover since every edge isadjacent to a chosen node

Page 17: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 17

Explanation for general case:

1x1x 2x

2x 3x3x 4x

4x

Edges in variable gadgets are incident to at least one node in cover

Page 18: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 18

1x

2x 3x

1x

2x 4x

1x

3x 4x

Edges in clause gadgets are incident to at least one node in cover,since two nodes are chosen in a clause gadget

Page 19: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 19

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

Every edge connecting variable gadgetsand clause gadgets is one of three types:

Type 1 Type 2 Type 3

All adjacent to nodes in cover

Page 20: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 20

If graph contains a vertex-coverof size then formula is satisfiable

G

lmk 2

Second direction of proof:

Page 21: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 21

Example:

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

Page 22: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 22

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

exactly one literal in each variable gadget is chosen

exactly two nodes in each clause gadget is chosen

To include “internal’’ edges to gadgets,and satisfy lmk 2

mchosen out of m2

l2 l3chosen out of

Page 23: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 23

For the variable assignment choose the literals in the cover from variable gadgets

1x1x 2x

2x 3x3x 4x

4x

1 0 0 1 4321 xxxx

)()()( 431421321 xxxxxxxxx

Page 24: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 24

1x1x 2x

2x 3x3x 4x

4x

1x

2x 3x

1x

2x 4x

1x

3x 4x

1 0 0 1 4321 xxxx

)()()( 431421321 xxxxxxxxx

since the respective literals satisfy the clauses

is satisfied with

Page 25: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 25

Theorem:

1. HAMILTONIAN-PATH is in NP

2. We will reduce in polynomial time 3CNF-SAT to HAMILTONIAN-PATH

Can be easily proven

HAMILTONIAN-PATH is NP-complete

Proof:

(NP-complete)

Page 26: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 26

)()( 2121 xxxx

)( 21 xx

)( 21 xx

Gadget for variable 1x

the directionschange

Page 27: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 27

)()( 2121 xxxx

)( 21 xx

)( 21 xx

Gadget for variable 2x

Page 28: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 28

)( 21 xx

)( 21 xx

1x

2x

)()( 2121 xxxx

Page 29: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 29

)( 21 xx

)( 21 xx

11 x

12 x

1)()( 2121 xxxx

Page 30: Prof. Busch - LSU1 More NP-complete Problems. Prof. Busch - LSU2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible to

Prof. Busch - LSU 30

)( 21 xx

)( 21 xx

01 x

12 x

1)()( 2121 xxxx