Presentation is loading. Please wait.

Presentation is loading. Please wait.

Probleem P 1 is reduceerbaar tot P 2 als  afbeelding  :P 1  P 2 zo dat: I yes-instantie van P 1   (I) yes-instantie van P 2 als ook:  polytime-algoritme,

Similar presentations


Presentation on theme: "Probleem P 1 is reduceerbaar tot P 2 als  afbeelding  :P 1  P 2 zo dat: I yes-instantie van P 1   (I) yes-instantie van P 2 als ook:  polytime-algoritme,"— Presentation transcript:

1 probleem P 1 is reduceerbaar tot P 2 als  afbeelding  :P 1  P 2 zo dat: I yes-instantie van P 1   (I) yes-instantie van P 2 als ook:  polytime-algoritme, zeg A , met inputs I  P 1 en outputs  (I)  P 2 dan P 1 is 'polynomial ‑ reducable' tot P 2, notatie: P 1  P 2 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 polytime- algorithm A, then all problems P   are polynomial solvable (  =  ) Proof: IPIP  P (I)  SAT A  P O(| | r ) alg. A O(| | q ) yes/no algoritme in O(|I| qr ) time voor I in P: doe eerst A  P /* geeft I' in SAT van size O(| | r ) doe dan A

2 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

3 CLIQUE Instance: graph G=(V, E) ; number k; Question:Is there a ‘clique’ subgraph H  G with |V(H)|>=k YES for k=3 YES for k=4 NO for k=5

4 Is there a clique of size >= 4 ?

5

6 Satisfiability (formeel) Instance:2n booleans in sets B={b 1, b 2,..., b n } en B ={b 1, b 2,..., b n }, [n-tal B={b 1,..., b n } is vrij, n-tal B={b 1, b 2,..., b n } is negatie dwz: vrij te kiezen: b 1,..., b n  {true,false} en b t = NOT b t voor t=1,2..n] m ‘or-expressies’ C 1, C 2,..., C m met 1 of meer elementen in B  B Question: Kan men b 1 t/m b n zo kiezen (  truth-assignment) dat elke 'clause' C 1, C 2,..., C m true wordt. (satisfying all the clauses) bv n=3, m=4 met C 1 =b 1 or b 3 or b 2 ; C 2 =b 2 or b 1 ; C 3 =b 3 or b 1 ; C 4 =b 2 assignment b 1 =b 2 =b 3 =true mislukt; assignment b 1 =true; b 2 =b 3 =false mislukt; assignment b 2 =true, b 1 =b 3 =false satisfies all clauses

7 Een probleem P zal  -compleet zijn als: 1) P is in  2) voor een bekend  -compleet P 2 geldt: P 2  P voorbeeld: Clique is  -compleet 1) yes-certificaat is subset K met k knopen; O(n 2 ) algoritme checkt kantexistentie 2) we tonen aan SAT  CLIQUE : Zij B={b 1,…,b n }; C 1, C 2, …,C m, een SAT-instantie. bv: B={b1,b2,b3} en m=4 met C 1 =b 1 or b 3 or b 2 ; C 2 =b 2 or b 1 ; C 3 =b 3 or b 1 ; C 4 =b 2 elke clause correspondeert met knopenregel, 1 knoop voor elke boolean alle kanten bestaan behalve: tussen knopen (booleans) van dezelfde clause tussen booleans die elkaars negatie zijn

8 YES:  V’ for k=5 NODE-COVER Instance: graph G=(V, E) ; number k ; Question:can one cover E with a subset V’ of k or less nodes YES:  V’ for k=3

9 Theorem: V’ is a node-cover of E(G) if and only if V\V’ forms a clique in G 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 COROLLARY: CLIQUE  NODE-COVER map I= of CLIQUE to  (I)= of NODE-COVER, given as  (V)=V,  (E)=co-E and  (k)=|V|-k

10 CLIQUE  NODE-COVER map I= of CLIQUE to  (I) of NODECOVER, where  (V,E)=(V,co-E) and  (k)=|V|-k to proof: 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)

11 SAT  ILP (remember ILP: instance: (c,A,b) en k; question Is max {cx: Ax =k) SAT Instance: 2n booleans in sets B={b 1, b 2,..., b n } en B ={b 1, b 2,..., b n },  m ‘or-expressies’ C 1, C 2,..., C m met 1 of meer elementen in B  B vb n=3, m=4 met C 1 =b 1 or b 3 or b 2 ; C 2 =b 2 or b 1 ; C 3 =b 3 or b 1 ; C 4 =b 2 Trafo: Introduceer een 0-1 variabele x b voor iedere b  B en een voorwaarde en 0-1- variabele y i voor de tevredenheid van iedere clause We illustreren op het voorbeeld: Kies k=m max y 1 +…+y m x 1 +x 3 +(1-x 2 ) >= y 1.. x 2 >= y 4 x j, y i 

12 YES:  V’ for k=5 NODE-COVER Instance: graph G=(V, E) ; number k ; Question:can one cover E with a subset V’ of k or less nodes YES:  V’ for k=3

13 SAT(isfiability) Instance:2n booleans in sets B={b 1, b 2,..., b n } en B ={b 1, b 2,..., b n }, vrij te kiezen: b 1,..., b n  {true,false} en b t = NOT b t voor t=1,2..n] m ‘or-expressies’ C 1, C 2,..., C m met 1 of meer elementen van B  B Question: Kan men b 1 t/m b n zo kiezen (  truth-assignment) dat elke 'clause' C 1, C 2,..., C m 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={b 1, b 2,..., b n } en B ={b 1, b 2,..., b n }, vrij te kiezen: b 1,..., b n  {true,false} en b t = NOT b t voor t=1,2..n m ‘or-expressies’ C 1,..., C m elk met <=3 elementen van B  B Question: Kan men b 1 t/m b n zo kiezen (  truth-assignment) dat elke 'clause' C 1, C 2,..., C m true wordt. (satisfying all the clauses)

14 SET-COVER Instance: m sets S 1, S 2,... S m 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. S 1,…S m covers {1,2…n}) ] Question:Is there a subcover of {1,2,.., n} with k subsets or less EXACT-COVER Instance: m sets S 1, S 2,... S m subsets of {1,2,.., n}; [note: Each i=1,2..n lies in one or more subsets (i.e. S 1,…S m 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 S 1,... S m of {1,2,.., n} with weights w 1, …w m ; 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 NODE-cover  SET-COVER: Basis set {1,…n} correspond to the edges e 1, e n of (V,E) assume |E|=n subset S i defined for each i  V is the set of numbers (edges) incident to i

15 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 c ij >= 0; number k; Question:Is there a cutset [S, N\S] with capacity PARTITIONING Instance: indexed set of numbers {w 1,w 2,.., w n } Question: can one partition the index set {1..n}=I  J such that: SUBSET SUM Instance: indexed set of numbers {w 1,w 2,.., w n } ; number k Question: Is there a subset of indices I such that

16 2Dimensional Matching (2DM) Instance: set V={1,2,…,n}; P  VxV a set (of more than n) pairs Question: Is there a subset P'={(x 1,y 1 ), … (x n,y n )} in P with {x 1,..,x n }=V and {y 1,..,y n }=V 3Dimensional Matching (3DM) Instance: set V={1,…n}; T  VxVxV a set of triplets Question: Is there a subset T ’ = {(x 1,y 1,,z 1, ), … (x n,y n,z n, )} of T with with {x 1,..,x n }=V and {y 1,..,y n }=V and {z 1,..,z n }=V Alternative definition: 2Dimensional Matching (2DM) (and analogously fo 3DM) Instance: two different sets X={x 1,..,x n } and Y ={y 1,..,y n } both with n elements; P  XxY a set of pairs (x,y) Question: Is there a subset P'={(x i1,y j1 ), … (x in,y jn )} of P with {x i1,.., x in }=X and {y j1,.., y jn }=Y (i.e., all x- and y-coordinates in P' are different) Application (2DM) X={x 1,..,x n } a set of gentlemen and Y ={y 1,..,y n } 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'={(x i1,y j1 ), … (x in,y jn )} of P with {x i1,.., x in }=X and {y j1,.., y jn }=Y (i.e., no x i nor y i is married off twice)

17 set cover SAT(isfiability) 3-SAT clique node cover weighted set cover ILP Steiner problem exact cover graph coloring knapsack partitioning Max-cut 2-DM Ham-Cycle (&TSP) subset sum 3-DM min-cost flow 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


Download ppt "Probleem P 1 is reduceerbaar tot P 2 als  afbeelding  :P 1  P 2 zo dat: I yes-instantie van P 1   (I) yes-instantie van P 2 als ook:  polytime-algoritme,"

Similar presentations


Ads by Google