Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
probleem P1 is reduceerbaar tot P2 als afbeelding :P1 P2 zo dat:
I yes-instantie van P1 (I) yes-instantie van P2
als ook:
polytime-algoritme, zeg A, met inputs IP1 en outputs (I)P2
dan P1 is 'polynomial-reducable' tot P2 , notatie: P1 P2
Theorem Cook (1971): SAT is -compleet, i.e.:
each problem P of is polynomial reducable to SAT
Corollary If SAT (or another -compleet problem) is solved by a polytimealgorithm A, then all problems P are polynomial solvable (=)
Proof:
P(I)SAT
AP
O(| |r)
IP
alg. A
O(| |q)
yes/no
algoritme in O(|I|qr) time voor I in P:
doe eerst AP /* geeft I' in SAT van size O(| |r)
doe dan A
Observation 1 Given a problem P in
If SAT (or more general a known -compleet problem) is polytime-transformable to P,
then P is -compleet
Observation 2 Given a problem P in
If P is polytime-transformable to another polunomially-solvable problem Q in ,
then P also is in
Next we use observation 1 for the problems P=CLIQUE and P=NODE-COVER.
First we introduce these problems
CLIQUE
Instance: graph G=(V, E) ; number k;
Question:Is there a ‘clique’ subgraph HG with |V(H)|>=k
YES for k=4
YES for k=3
NO for k=5
Is there a clique of
size >= 4 ?
1
2
4
5
6
3
7
8
Is there a clique of
size >= 4 ?
1
2
4
5
6
3
7
8
Satisfiability (formeel)
Instance:2n booleans in sets B={b1, b2, ..., bn} en B ={b1, b2, ..., bn},
[n-tal B={b1,..., bn} is vrij, n-tal B={b1, b2, ..., bn} is negatie
dwz: vrij te kiezen: b1, ..., bn{true,false} en bt = NOT bt voor t=1,2..n]
m ‘or-expressies’ C1, C2, ..., Cm met 1 of meer elementen in B B
Question: Kan men b1 t/m bn zo kiezen ( truth-assignment)
dat elke 'clause' C1, C2, ..., Cm true wordt. (satisfying all the clauses)
bv n=3, m=4 met C1=b1 or b3 or b2 ;
C2=b2 or b1;
C3=b3 or b1;
C4=b2
assignment b1=b2=b3=true mislukt; assignment b1=true; b2=b3=false mislukt;
assignment b2=true, b1=b3=false satisfies all clauses
elke clause correspondeert met knopenregel, 1 knoop voor elke boolean
alle kanten bestaan behalve:
Een probleem P zal -compleet zijn als:
• tussen knopen (booleans) van dezelfde clause
1) P is in
• tussen booleans die elkaars negatie zijn
2) voor een bekend -compleet P2 geldt: P2 P
voorbeeld: Clique is -compleet
1) yes-certificaat is subset K met k knopen; O(n2) algoritme checkt kantexistentie
2) we tonen aan SAT CLIQUE : Zij B={b1,…,bn}; C1, C2, …,Cm, een SAT-instantie.
bv: B={b1,b2,b3} en m=4 met
C1=b1 or b3 or b2 ;
b1
b2
C2=b2 or b1;
b1
b2
C3=b3 or b1;
C4=b2
b1
b3
b3
b2
YES: V’
for k=5
YES: V’
for k=3
NODE-COVER
Instance: graph G=(V, E) ; number k ;
Question:can one cover E with a subset V’ of k or less nodes
DEFINITION: The co-graph G=(V, co-E) of G=(V, E) has the same node set,
but the complement set co-E as edge set: co-E ={(i,j): (i,j)E}
G’s edges on
upper-left node
Theorem: V’ is a node-cover of E(G) if and only if V\V’ forms a clique in G
COROLLARY: CLIQUE NODE-COVER
map I=<(V, E), k> of CLIQUE to (I)=<((V), (E)), (k)> of NODE-COVER,
given as (V)=V , (E)=co-E and (k)=|V|-k
CLIQUE NODE-COVER
map I=<(V, E), k> of CLIQUE to (I) of NODECOVER,
where (V,E)=(V,co-E) and (k)=|V|-k
to proof:
<(V, E), k> is yes instantie clique <(V,co-E),|V|-k> yes instantie node-cover
proof:
node set H forms a clique in (V,E) with |H|>=k
/* i.e. H is yes-certificate for I
iff
( i, j H: (i,j) E ) and ( |H|>=k )
iff
( i, j H: (i,j) co-E) and ( |H|>=k )
iff
for each edge (i, j) of (V,co-E) node i is in V\H or node j is in V\H
and |V\H|<=|V|-k
iff
V\H is a node cover of (V, co-E) with |V\H|<=|V|-k
/* i.e. V\H is yes-certificate for (I), (k)
SAT ILP (remember ILP: instance: (c,A,b) en k; question Is max {cx: Ax<=b, x Zn}>=k)
SAT
Instance: 2n booleans in sets B={b1, b2, ..., bn} en B ={b1, b2, ..., bn},
m ‘or-expressies’ C1, C2, ..., Cm met 1 of meer elementen in B B
vb n=3, m=4 met C1=b1 or b3 or b2 ;
C2=b2 or b1;
C3=b3 or b1;
C4=b2
Trafo: Introduceer een 0-1 variabele xb voor iedere b B en een voorwaarde en 0-1variabele yi voor de tevredenheid van iedere clause
We illustreren op het voorbeeld: Kies k=m
max
y1+…+ym
x1+x3+(1-x2) >= y1
..
x2 >= y4
xj , yi {0,1}
YES: V’
for k=5
YES: V’
for k=3
NODE-COVER
Instance: graph G=(V, E) ; number k ;
Question:can one cover E with a subset V’ of k or less nodes
SAT(isfiability)
Instance:2n booleans in sets B={b1, b2, ..., bn} en B ={b1, b2, ..., bn},
vrij te kiezen: b1, ..., bn{true,false} en bt = NOT bt voor t=1,2..n]
m ‘or-expressies’ C1, C2, ..., Cm met 1 of meer elementen van B B
Question: Kan men b1 t/m bn zo kiezen ( truth-assignment)
dat elke 'clause' C1, C2, ..., Cm true wordt. (satisfying all the clauses)
A special case of a problem restricts itself to instances of special type
Special cases of -compleet problems may lie in
3-SAT restricts itself to instances of SAT where each clause <=3 booleans:
3-SAT
Instance:2n booleans in sets B={b1, b2, ..., bn} en B ={b1, b2, ..., bn},
vrij te kiezen: b1, ..., bn{true,false} en bt = NOT bt voor t=1,2..n
m ‘or-expressies’ C1, ..., Cm elk
met <=3 elementen van B B
Question: Kan men b1 t/m bn zo kiezen ( truth-assignment)
dat elke 'clause' C1, C2, ..., Cm true wordt. (satisfying all the clauses)
SET-COVER
Instance: m sets S1, S2, ... Sm subsets of {1,2,.., n}; a number k (< m)
[note: Each i=1,2..n lies in one or more of the subsets (i.e. S1,…Sm covers {1,2…n}) ]
Question:Is there a subcover of {1,2,.., n} with k subsets or less
NODE-cover SET-COVER:
Basis set {1,…n} correspond to the edges e1 , en of (V,E) assume |E|=n
subset Si defined for each i V is the set of numbers (edges) incident to i
EXACT-COVER
Instance: m sets S1, S2, ... Sm subsets of {1,2,.., n};
[note: Each i=1,2..n lies in one or more subsets (i.e. S1,…Sm covers {1,2…n}) ]
Question:Is there a subcover of {1,2,.., n} with k<m subsets s.t. each i (=1,2…n) is
in exactly one of these k subsets
Weighted SET-COVER
Instance: m subsets S1, ... Sm of {1,2,.., n} with weights w1, …wm; number k
Question:Is there a subcover of total weight less than k
HAMILTONIAN CYCLE (=special case of TSP with all edge weights 1)
Instance: graph G=(V, E) with n nodes;
Question:Is there H E with (|H|=n) edges as a tour visiting every node exactly once
GRAPH COLORING
Instance: graph G=(V, E) ; number k;
Question:Can we give each node i a color c(i) {1,2..k} s.t. c(i)<>c(j) if (i,j) E
(i and j have different colors when they are connected by an edge)
MAX-CUT
Instance: network (N, E) with edge weights cij >= 0; number k;
Question:Is there a cutset [S, N\S] with capacity cij k
(i, j )E
iS
jS
PARTITIONING
Instance: indexed set of numbers {w1,w2,.., wn}
Question: can one partition the index set {1..n}=I J such that:
wi w j
iI
SUBSET SUM
Instance: indexed set of numbers {w1,w2,.., wn} ; number k
Question: Is there a subset of indices I such that
wi k
iI
jJ
2Dimensional Matching (2DM)
Instance: set V={1,2,…,n}; P VxV a set (of more than n) pairs
Question: Is there a subset P'={(x1,y1), … (xn,yn)} in P with
{x1,..,xn}=V and {y1,..,yn}=V
3Dimensional Matching (3DM)
Instance: set V={1,…n}; T VxVxV a set of triplets
Question: Is there a subset T ’ = {(x1,y1, ,z1,), … (xn,yn,zn,)} of T with
with {x1,..,xn}=V and {y1,..,yn}=V and {z1,..,zn}=V
Alternative definition: 2Dimensional Matching (2DM) (and analogously fo 3DM)
Instance: two different sets X={x1,..,xn} and Y ={y1,..,yn} both with n elements;
P XxY a set of pairs (x,y)
Question: Is there a subset P'={(xi1,yj1), … (xin,yjn)} of P with
{xi1 ,.., xin}=X and {yj1 , .., yjn}=Y (i.e., all x- and y-coordinates in P' are different)
Application (2DM)
X={x1,..,xn} a set of gentlemen and Y ={y1,..,yn} a set of ladies;
P XxY a set of matching pairs (x,y) that like each other enough (to get married)
One can marry off all persons, make n (legally) married couples if and only
if there is a subset P'={(xi1,yj1), … (xin,yjn)} of P with
{xi1 ,.., xin}=X and {yj1 , .., yjn}=Y (i.e., no xi nor yi is married off twice)
problemen en mogelijke trafo's die NP-completeness aantonen (of case: 2DM of juist niet)
pijl dik zwart: op college bewezen; pijl dun zwart: zie R. KARP '72;
pijl rood: zelf bewijzen als serie 7A uitwerking inleveren van minstens 2 van de vier
SAT(isfiability)
clique
node cover
set cover
Ham-Cycle
(&TSP)
3-SAT
ILP
graph coloring
2-DM
exact cover
subset sum
weighted set cover
Steiner problem
min-cost
flow
partitioning
Max-cut
knapsack
3-DM