NP-Completeness : Proofs • • Proof Methods • • A method to show a decision problem Π Π Π Π NP-complete is as follows. (1) Show Π Π Π ∈ Π ∈ ∈ ∈ NP. (2) Choose an NP-complete problem Π Π Π Π ’ . (3) Show Π Π Π Π ’ ∝ ∝ Π ∝ ∝ Π . Π Π A method to show an optimization problem Ψ Ψ Ψ Ψ NP-hard is as follows. (1) Choose an NP-hard problem Ψ Ψ Ψ Ψ ’ ( Ψ Ψ ’ may be Ψ Ψ NP-complete). (2) Show Ψ Ψ ’ ∝ ∝ Ψ Ψ . Ψ Ψ ∝ ∝ Ψ Ψ An alternative method to show Ψ Ψ Ψ Ψ NP-hard is to show the decision version of Ψ Ψ Ψ NP-complete. Ψ 1
• • Two Simple Examples • • Ex. Sum of Subsets Instance : A finite set A of positive integers and a positive integer c . Question : Is there a subset A’ of A whose elements sum to c ? For example, if A = {7, 5, 19, 1, 12, 8, 14} and c = 21, then the answer is yes ( A’ = {7, 14}). NP-completeness of Sum of Subsets is shown below. ♣ Sum of Subsets ∈ ∈ NP. ∈ ∈ ♣ A chosen NP-complete problem : Exact Cover. 2
Exact Cover Instance : A finite set S and k subsets S 1 , S 2 , …, S k of S . Question : Is there a subset of { S 1 , S 2 , …, S k } that forms a partition of S ? For example, if S = {7, 5, 19, 1, 12, 8, 14}, k = 4, S 1 = {7, 19, 12, 14}, S 2 = {7, 5, 8}, S 3 = {5, 1, 8}, and S 4 = {19, 1, 8, 14}, then the answer is yes ({ S 1 , S 3 } forms a partition of S ). 3
♣ Exact Cover ∝ ∝ ∝ ∝ Sum of Subsets. Let S = { u 1 , u 2 , …, u m } and S 1 , S 2 , …, S k be an arbitrary instance of Exact Cover. An instance of Sum of Subsets can be obtained in polynomial time as follows. − m 1 ∑ i ) k + 1 A = { a 1 , a 2 , …, a k } and c = ( , = i 0 where for 1 ≤ ≤ ≤ j ≤ ≤ ≤ k , ≤ ≤ m ∑ − i 1 ) e k + 1 a j = , ( , j i i = 1 with e j , i = 1 if u i ∈ ∈ ∈ ∈ S j and e j , i = 0 if u i ∉ ∉ S j . ∉ ∉ ⇒ Sum of Subsets has the answer yes if and only if Exact Cover has the answer yes . 4
For example, given the following instance of Exact Cover : S = {7, 5, 19, 1, 12, 8, 14}, k = 4, S 1 = {7, 19, 12, 14}, S 2 = {7, 5, 8}, S 3 = {5, 1, 8}, and S 4 = {19, 1, 8, 4}, a matrix e is defined as follows. 7 5 19 1 12 8 14 1 0 1 0 1 0 1 S 1 S 1 1 0 0 0 1 0 2 S 0 1 0 1 0 1 0 3 0 0 1 1 0 1 1 S 4 An instance of Sum of Subsets is constructed as follows. 5
A = { a 1 , a 2 , a 3 , a 4 } and c = 5 0 + 5 1 + 5 2 + … + 5 6 , where a 1 = 5 0 + 5 2 + 5 4 + 5 6 (1 st row of e ); a 2 = 5 0 + 5 1 + 5 5 (2 nd row of e ); a 3 = 5 1 + 5 3 + 5 5 (3 rd row of e ); (4 th row of e ). a 4 = 5 2 + 5 3 + 5 5 + 5 6 The construction relates a i with S i and c with S . It is not difficult to see a 1 + a 3 = c ⇔ ⇔ S 1 ∪ ⇔ ⇔ ∪ ∪ S 3 = S and S 1 ∩ ∪ ∩ ∩ ∩ S 3 = ∅ ∅ ∅ ∅ . 6
Ex. Partition Instance : A multiset B = { b 1 , b 2 , …, b n } of positive integers. Question : Is there a subset B’ ⊆ ⊆ ⊆ B such that ⊆ ∑ ∑ b b = ? i j b ∈ ∈ ∈ ∈ B' b ∈ ∈ ∈ ∈ B B' − i j For example, when B = {17, 53, 9, 35, 41, 32, 35}, then the answer is yes ( B’ = {17, 53, 41}). NP-completeness of Partition is shown below. ♣ Partition ∈ ∈ ∈ NP. ∈ ♣ A chosen NP-complete problem : Sum of Subsets. 7
♣ Sum of Subsets ∝ ∝ ∝ ∝ Partition Let A = { a 1 , a 2 , …, a m } and c be an arbitrary instance of Sum of Subsets. An instance of Partition can be obtained in polynomial time as follows: B = A ∪ ∪ { a m +1 , a m +2 }, ∪ ∪ ∑ a where a m +1 = c + 1 and a m +2 = 1 − − − − c + . i a ∈ ∈ ∈ ∈ A i ∑ Since a m +1 + a m +2 = a + 2, we have i ∈ ∈ a ∈ ∈ A i { a m +1 , a m +2 } ⊄ ⊄ ⊄ B’ and { a m +1 , a m +2 } ⊄ ⊄ ⊄ ⊄ B − ⊄ − − − B’ . ∑ We show below that a = c if and only if i Α ' ∈ ∈ a ∈ ∈ i ∑ ∑ a m +2 + a = a m +1 + a i i Α ' Α Α ' ∈ ∈ ∈ ∈ − a ∈ ∈ a ∈ ∈ i i (i.e., B’ = A’ + { a m +2 }). 8
( ⇒ ⇒ ) Suppose ∑ ⇒ ⇒ a = c . i Α ' a ∈ ∈ ∈ ∈ i ∑ ∑ ∑ a a a a m +2 + = (1 − − c + − − ) + i i i Α ' Α ' a ∈ ∈ ∈ ∈ a ∈ ∈ ∈ ∈ A a ∈ ∈ ∈ ∈ i i i ∑ a = 1 + . i Α a ∈ ∈ ∈ ∈ i ∑ ∑ a a a m +1 + = ( c + 1) + i i Α Α ' Α Α ' ∈ ∈ − ∈ ∈ − a ∈ ∈ a ∈ ∈ i i ∑ a = 1 + . i Α ∈ ∈ a ∈ ∈ i ∑ ∑ a a ( ⇐ ⇐ ⇐ ) Suppose a m +2 + ⇐ = a m +1 + , i i Α ' Α Α ' a ∈ ∈ ∈ ∈ a ∈ ∈ ∈ ∈ − i i i.e., B’ = A’ + { a m +2 }. ∑ ∑ a a Then, (1 − − − − c + ) + = ( c + 1) + i i Α ' a ∈ ∈ ∈ ∈ A a ∈ ∈ ∈ ∈ i i ∑ a , i Α Α ' ∈ ∈ − a ∈ ∈ i ∑ from which a = c can be derived. i Α ' ∈ ∈ a ∈ ∈ i 9
Exercise 5. Read Example 8-14 on page 367 of the textbook. (1) Give a reduction from Partition to the bin packing problem. (2) Illustrate the reduction by an example. (3) Verify the reduction. Exercise 6. Read Theorem 11.2 on page 518 of Ref. (2). (1) Give a reduction from Satisfiability to Clique. (2) Illustrate the reduction by an example. (3) Verify the reduction. 10
• • Three Proof Techniques • • Restriction Local Replacement Component Design 11
• • Restriction • • If a problem Π Π Π Π contains an NP-hard problem Π Π Π ’ Π as a special case (i.e., Π Π Π Π ’ is a restricted subproblem of Π Π Π Π ), then Π Π is NP-hard. Π Π Ex. Exact Cover Instance : A finite set S and k subsets S 1 , S 2 , …, S k of S . Question : Is there a subset of { S 1 , S 2 , …, S k } that forms a partition of S ? Exact Cover by 3-Sets Instance : A finite set S with | S | = 3 p and k 3- element subsets S 1 , S 2 , …, S k of S . Question : Is there a subset of { S 1 , S 2 , …, S k } that forms a partition of S ? 12
Exact Cover by 3-Sets is a special case of Exact Cover. 3-Dimensional Matching Instance : A set M ⊆ ⊆ ⊆ W × ⊆ × × × X × × Y , where W , X × × and Y are three disjoint q -element subsets. Question : Does M contain a matching , i.e., a subset M’ ⊆ ⊆ ⊆ M such that | M’ | = q ⊆ and no two elements of M’ agree in any coordinate ? For example, if W = {0, 1}, X = { a , b }, Y = { + + + + , − − − − }, and M = {(0, a , + + ), (1, b , + + + + + + ), (1, b , − − − )}, then the − answer is yes ( M’ = {(0, a , + + ), (1, b , − + + − − )}). − 3-Dimensional Matching is a special case of Exact Cover by 3-Sets. 13
For example, the following instance of 3-Dimensional Matching : W = {0, 1}, X = { a , b }, Y = { + + + + , − − − − }, and M = {(0, a , + + + ), (1, b , + + + + + ), (1, b , − − − )} − can be transformed into an instance of Exact Cover by 3-Sets as follows : S 1 = {0 W , a X , + + + + Y }, S 2 = {1 W , b X , + + Y }, S 3 = {1 W , b X , − + + − − − Y }, and S = W ∪ ∪ ∪ X ∪ ∪ ∪ Y = {0 W , 1 W , a X , b X , + ∪ ∪ + + Y , − + − − Y }. − Therefore, 3-Dimensional Matching is NP-complete. ⇒ ⇒ ⇒ ⇒ Exact Cover by 3-Sets is NP-complete. ⇒ ⇒ ⇒ ⇒ Exact Cover is NP-complete. 14
Ex. Hamiltonian Cycle Instance : An undirected graph G = ( V , E ). Question : Does G contain a Hamiltonian Cycle , i.e., an ordering ( v 1 , v 2 , …, v | V | ) of the vertices of G such that ( v 1 , v | V | ) ∈ ∈ ∈ ∈ E and ( v i , v i +1 ) ∈ ∈ E for all 1 ≤ ∈ ∈ ≤ ≤ i < | V | ? ≤ Directed Hamiltonian Cycle Instance : A directed graph G = ( V , A ), where A is a set of arcs (i.e., ordered pairs of vertices). Question : Does G contain a directed Hamiltonian cycle , i.e., an ordering ( v 1 , v 2 , …, v | V | ) of the vertices of G such that ( v 1 , v | V | ) ∈ ∈ ∈ ∈ A and ( v i , v i +1 ) ∈ ∈ ∈ A for all 1 ≤ ∈ ≤ ≤ i < | V | ? ≤ 15
Hamiltonian Cycle is a special case of Directed Hamiltonian Cycle (or Hamiltonian Cycle ∝ ∝ ∝ ∝ Directed Hamiltonian Cycle, where each ( u , v ) ∈ ∈ ∈ E ∈ corresponds to two arcs ( u , v ), ( v , u ) ∈ ∈ ∈ A ). ∈ Therefore, Hamiltonian Cycle is NP-complete. ⇒ Directed Hamiltonian Cycle is NP-complete. ⇒ ⇒ ⇒ 16
Hamiltonian Path between Two Vertices Instance : An undirected graph G = ( V , E ) and two distinct vertices u , v ∈ ∈ V . ∈ ∈ Question : Does G contain a Hamiltonian path starting at u and ending at v , i.e., an ordering ( v 1 , v 2 , …, v | V | ) of the vertices of G such that u = v 1 , v = v | V | , and ( v i , v i +1 ) ∈ ∈ ∈ ∈ E for all 1 ≤ ≤ i < | V | ? ≤ ≤ Hamiltonian Cycle ∝ ∝ ∝ ∝ Hamiltonian Path between Two Vertices : if the latter is polynomial time solvable, then the former is also polynomial time solvable (considering all edges ( u , v ) ∈ ∈ ∈ V ∈ for the latter). ⇒ ⇒ Hamiltonian Path between Two Vertices is ⇒ ⇒ NP-complete. 17
Recommend
More recommend