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,

Slides:



Advertisements
Similar presentations
P, NP, NP-Complete Problems
Advertisements

Max Cut Problem Daniel Natapov.
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
NP and NP Complete. Definitions A problem is in the class P if there is a polynomial time solution to the problem A problem is in the class NP if there.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
CS21 Decidability and Tractability
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Clique Cover Cook’s Theorem 3SAT and Independent Set
Hardness Results for Problems
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Lecture 22 More NPC problems
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Summary  NP-hard and NP-complete  NP-completeness proof  Polynomial time reduction  List of NP-complete problems  Knapsack problem  Isomprphisim.
1 3-COLOURING: Input: Graph G Question: Does there exist a way to 3-colour the vertices of G so that adjacent vertices are different colours? 1.What could.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1.1 Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NP-Completeness Note. Some illustrations are taken from (KT) Kleinberg and Tardos. Algorithm Design (DPV)Dasgupta, Papadimitriou, and Vazirani. Algorithms.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
NP-Completeness A problem is NP-complete if: It is in NP
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Chapter 10 NP-Complete Problems.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
COMPLEXITY THEORY IN PRACTICE
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
NP-Complete Problems.
CSC 4170 Theory of Computation The class NP Section 7.3.
Prabhas Chongstitvatana
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

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

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 H  G with |V(H)|>=k YES for k=3 YES for k=4 NO for k=5

Is there a clique of size >= 4 ?

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

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

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

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

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)

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 

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

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)

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

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

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)

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