Lecture 12 NP Class - University of Texas at Dallas

Download Report

Transcript Lecture 12 NP Class - University of Texas at Dallas

Lecture 8-9 More examples
Integer Programming
TSP
VC
HC
Knapsack
3DM
3SAT
SAT
Partition
Planar 3SAT
Vertex-Cover is NP-complete
Proof.
3SAT  mp Vertex - Cover
f : inputsof 3SAT  inputsof Vertex - Cover
For each 3CNF F , construct f ( F )  G, k ,
where G is a graph and k  0, such that
F  3SAT  G has a vertex- coverof size  k.
x1
x1
x2
x2
x3 x3 x4
c13
c23
c1
c11
x4
c2
c12 c21
( x1  x3  x2 )(x3  x4  x1 )
c22
Suppose F containsn variablesand m
clauses. Set k  n  m.
T hen,G has vertex- coverof size n  m
 F  3SAT.
HC is NP-complete
3SAT  mp HC
For each 3CNF F , constructa graph f ( F )  G
such thatF  3STA  G containsa Hamiltonian
cycle.
x2
x1
x1
c1
c1  x1  x2  x3
x3
x2
x1
x1
c1
c1  x1  x2  x3
x3
3DM
3 - Dimensional Matching(3DM):
Given t hree disjoint set s X , Y , Z each
of n element s,and a collectionC of 3 - set s each
of which cont ainsan elementof X , an element
of Y and an elementof Z , determinewhether
C cont ainsa 3 - dimensional mat ching,i.e., a
subcollection C ' of n 3 - set s, cont ainingall
element sof X  Y  Z .
Example of 3DM
• Messrs. Spinnaker, Buoy, Luff, Gybe, and
Windward are yacht owners. Each has a
daughter, and each has named his yacht after
the daughter of one of the others.
• Mr. Spinnaker’s yacht, the Iris, is named after
Mr. Buoy’s daughter. Mr. Buoy’s own yacht is
the Daffodil; Mr. Windward’s yacht is the Jonquil;
Mr. Gybe’s, the Anthea.
• Daffodil is the daughter of the owner of the yacht
which is named after Mr. Luff’s daughter. Mr.
Windward’s daughter is named Lalage.
• Who is Jonquil’s father?
3SAT  mp 3DM
For each 3CNF F , constructan instanceof 3DM
f ( F )  X , Y , Z , C 
such thatF  3STA  C containsa 3DM.
X
Y
Z
x1
c1  x1  
Suppose 3CNF F cont ainsn variables
and m clauses. T henfor each variable xi
constructa cycleof 2m 3 - set s. For each clause
c j constuct hree
t 3 - set s with t wonew vertices
in common.
In addition,constructmn m trashcans.
Trash Can (
)
Each trashcan consistsof an elementx  X
and an element y Y . For every z  Z ,
construct3 - set {x, y, z}.
Partition
Given a set of n positiveintegers,A  {a1 , a2 ,...,an }, is therea partition
A  A1  A2 such that  a 
aA1
 a.
aA2
3SAT  Partition
p
m
Let F be a 3CNF with m clauses C1 ,...,Cm and n variablesx1 ,..., xn .
We are going to define a list L of 2m  2n integers,
{b j ,k | 1  j  n, 0  k  1}  {ci ,k , | 1  i  m, 0  k  1} and
S.
L  {| 2S  sum( L) |} has a required partitioniff L has a sub - list L'
such thatsum( L' )  S if 2 S  sum( L).
T heyare all between 0 and 10m  n.
1 if 1    n
S [ ]  
3 if n  1    n  m
where S[] is theth digit of S .
S=33333333333333333333 1111111111111111111111
m 3' s
b j ,1
n 1' s
1
1
x j  C
xj
 1 if   j ,
b j , 0 []  b j ,1[]  
0 if 1    n and   j.
1 if x j  C
b j , 0 [ n  ]  
0 otherwise
1   m
1 if x j  C
b j ,1[n  ]  
0 otherwise
1   m
1 if   n  i
ci , 0 []  ci ,1[]  
0 otherwise
S  331111
b1,0  100001
b1,1  010001
b2,0  000010
b2,1  010010
b3,0  100100
b3,1  010100
b4,0  101000
b4,1  001000
c1,0  c1,1  010000
c2,0  c2,1  100000
( x1  x3  x2 )(x3  x4  x1 )
Puzzle
Given a set of n positiveintegers,A  {a1 , a2 ,...,an }, is therea partition
A  A1  A2 such that |  a   a | 2.
aA1
aA2
Answer
Partition mp Puzzle
For input set A of integers, construct
A'  {a 10 | a  A}.
Planar 3SAT
Planar CNF
A CNF is planarif thebipartitegraph between
clauses and variablesis planar.
e.g., ( x1  x2  x3 )(x2  x3  x4 )
C2
x1
x2
C1
x3
x4
Strongly Planar CNF
A CNF is planarif thebipartitegraph between
clauses and literalsplus all edges ( xi , xi ) forma
planargraph.
e.g., ( x1  x2  x3 )(x2  x3  x4 )
C2
x1
x1 x2
x2
C1
x4
x3 x3
x4
A strongly planar CNF must
be
a planar CNF!!!
2-3CNF
A 2 - 3CNF is an CNF in which each clause contains
either2 or 3 literals.
Planar 2-3SAT
Given a planar2 - 3CNF F , is F satisfiable?
Strongly Planar 2-3SAT
Given a stronglyplanar 2 - 3CNF F , is F satisfiable?
Planar 3SAT
Given a planar(type2)3CNF F , is F satisfiable?
Want to show
3SAT  mp Planar 2 - 3SAT
 Planar3SAT
p
m
3SAT  mp Planar 2 - 3SAT
 mp StronglyPlanar2 - 3SAT
 mp StronglyPlanar3SAT
3SAT  mp StronglyPlanar 2 - 3SAT
x

y


y
x
y  x  ( x  y),
x  ( x  y)  y
x  y  xy  xy
c( x, y, z )  ( x  y  z )(x  z )( y  z )
x  y  z  c( x, y, z )  SAT
x  y  z  c( x , y , z )  SAT
x  y  z  c( x, y, u )c(u , y, v )c( x, u , w )c(v, w, z )  SAT
x  y  ( x  y) y  x ( x  y)
x  y  z  x  y  u , u  y  v,
x  u  w, v  w  z.
c( x, y, z)  ( x  y  z )(x  z )( y  z ) is planar.
z
yz
xz
x
y
x yz
x  y  z  c( x, y, u )c(u , y, v )c( x, u , w )c(u, w, z )  SAT
c( x, y, u )c(u , y, v )c( x, u , w )c(u, w, z ) is planar.
z
v
w
u
x
y
Planar2 - 3SAT mp Planar3SAT
x yz
x
x y
y
x
z
x yz
y
Planar 2 - 3SAT  mp StronglyPlanar2 - 3SAT
Ci
Cj
Cj
Ci
w
xw
x
x
x
w
xw
x
Ci
Cj
Ci
Cj
x
x
x
x
Ci
Cj
Ci
Cj
x
x
x
x
StronglyPlanar2 - 3SAT mp StronglyPlanar3SAT
x yz
x
x y
y
x
z
z
x yz
y
Planar2 - 3SAT  mp StronglyPlanar2 - 3SAT
Ci
Cj
Cj
Ci
w w
xw
x
x
x
xw
x
Planar 2 - 3SAT  mp StronglyPlanar2 - 3SAT
Ci
x
Cj
x
Cj
Ci
x
x