Some NPcomplete problems SATISFIABILITY 01 Knapsack PARTITION TwoProcessor
• Some NP-complete problems : • • SATISFIABILITY 0/1 Knapsack PARTITION Two-Processor Non-Preemptive Schedule Length • CLIQUE : An undirected graph G=(V, E) and a positive integer J |V| Question : Does G contain a clique (complete subgraph) of size J or more? Young CS 530 Ad. Algo. D&A NP-Completeness 1
Proving NP-Completeness Results • Example 1 : Show that the PARTITION problem is NP-C (NP-complete). Given a known NP-C problem - Sum of Subset Problem (SS), show that PARTITION problem is NP-C. SS Problem Instance : Given a finite set A = {a 1, a 2, …, an} of n positive numbers & a positive number M. Question : Is there a subset A' A such that A' = M Young CS 530 Ad. Algo. D&A NP-Completeness 2
PARTITION Problem Instance : Given a finite set B={b 1, b 2, …, bm} of m positive integers & a positive integer B. Question : Is there a subset B' B such that B' = (B-B') • (1) Show that: PARTITION is in NP step#1: guess a subset B‘ of B (use one guess statement for each element) O(m) step#2: verify B' = (B-B')? O(m) Total O(m) Young CS 530 Ad. Algo. D&A NP-Completeness 3
• (2) Show that: SS PARTITION Given an arbitrary instance of SS, i. e. A = {a 1, a 2, …, an} and M, Construct an instance of PARTITION as follows : B={b 1, b 2, …, bn+1, bn+2} of m = n+2 positive numbers where bi bn+1 = ai for 1 i n = M + 1 bn+2 = A + (1 – M) Note : bi = 2 A + 2. Also, the transformation can be done in polynomial time (based on input size of A & M) Young CS 530 Ad. Algo. D&A NP-Completeness 4
To show the transformation is correct : The SS problem has a solution if and only if the PARTITION problem has a solution. Ø If SS problem has a solution, then the PARTITION problem has a solution assume A' is the solution for SS problem then Z' = A' {bn+2} and Z-Z' =A-A' {bn+1} Z' = M + A + (1 – M) = A + 1 = (Z-Z') Young CS 530 Ad. Algo. D&A NP-Completeness 5
Ø If the PARTITION problem has a solution then the SS problem has a solution if Z' is the solution then Z' = A + 1 exactly one of bn+2 or bn+1 Z' if bn+2 Z' then Z' – { bn+2 } = A' and A' = M if bn+1 Z', then use Z - Z' to obtain A' Young CS 530 Ad. Algo. D&A NP-Completeness 6
- Slides: 6