Approximation Algorithms (Part I) P : an optimization problem I : an instance of P A : an algorithm for solving P V ( I ) : the value for I that is obtained by A V* ( I ) : the optimal value for I A is an approximation algorithm for P , if for each I , A can generate a feasible solution with V ( I ) close to V* ( I ). 1
• Classification • • • Suppose that A is an approximation algorithm for an optimization problem P . ♣ A is an absolute approximation algorithm ♣ ♣ ♣ for P if and only if for each I , | V* ( I ) − − V ( I )| ≤ ≤ c , − − ≤ ≤ where c is a constant. ♣ ♣ A is an h ( n ) -approximate algorithm ♣ ♣ for P if and only if for each I , V * I ( ) V I ( ) − − − − ≤ h ( n ), ≤ ≤ ≤ V * I ( ) where n is the size of I . 2
♣ ♣ A is a c-approximate algorithm ♣ ♣ for P if and only if for each I , V * I ( ) V I ( ) − − − − ≤ c , ≤ ≤ ≤ V * I ( ) where c is a constant. V * I ( ) V I ( ) − − − − Notice that ≤ ≤ 1, if P is a ≤ ≤ V * I ( ) maximization problem. Hence, c < 1 is required for maximization problems. ♣ A is an approximation scheme for P if and ♣ ♣ ♣ only if for each given ε ε > 0 and for each I , ε ε A can generate a feasible solution with V * I ( ) V I ( ) − − − − ≤ ≤ ≤ ε ≤ ε . ε ε V * I ( ) The time complexity of A relies on the value of ε ε , ε ε in addition to the size of I . 3
♣ ♣ An approximation scheme is referred to as a ♣ ♣ polynomial time approximation scheme if and only if its time complexity is polynomial to the size of I . ♣ A polynomial time approximation scheme is ♣ ♣ ♣ further referred to as a fully polynomial time approximation scheme if and only if its time complexity is also polynomial to 1 ε . ε ε ε For some NP-hard problems, designing efficient and “accurate” approximation algorithms is as hard as designing efficient exact algorithms. 4
Ex. 0/1 Knapsack Instance : A finite set U = { u 1 , u 2 , …, u n }, ∈ Z + a “size” s ( u i ) ∈ and a “value” ∈ ∈ ∈ Z + v ( u i ) ∈ for each u i ∈ ∈ U , and a ∈ ∈ ∈ ∈ ∈ Z + . size constraint b ∈ ∈ ∈ Question : What is the subset U’ ⊆ ⊆ U such that ⊆ ⊆ ∑ ∑ s u ≤ ≤ b and v u is ( ) ≤ ≤ ( ) i i u U' u U' ∈ ∈ ∈ ∈ ∈ ∈ ∈ ∈ i i maximized ? There is an approximation algorithm as follows : examine the elements u i in nonincreasing order v u ( ) i of and add u i to U’ if feasible. s u ( ) i For the instance of U = { u 1 , u 2 }, v ( u 1 ) = 100, v ( u 2 ) = 20, s ( u 1 ) = 4, s ( u 2 ) = 1, and b = 4. ⇒ U’ = { u 1 } and V ( I ) = 100 = V* ( I ). ⇒ ⇒ ⇒ 5
Consider the following instance : U = { u 1 , u 2 }, v ( u 1 ) = 2, v ( u 2 ) = r , s ( u 1 ) = 1, s ( u 2 ) = r , and b = r , where r > 2. ⇒ U’ = { u 1 }, V ( I ) = 2, and V* ( I ) = r . ⇒ ⇒ ⇒ This algorithm is not an absolute approximation algorithm, because | V* ( I ) − − V ( I )| = r − − 2 is not a − − − − constant. This algorithm is a 1-approximate algorithm, V * I ( ) V I ( ) − 2 − − − − because = 1 ≤ 1. ≤ ≤ ≤ r V * I ( ) This algorithm is not a c -approximate algorithm for any c < 1. 6
• Absolute Approximation • • • Absolute approximation algorithms are the most desirable approximation algorithms. However, there are very few NP-hard problems whose polynomial-time absolute approximation algorithms are available. In particular, designing polynomial-time absolute approximation algorithms for some NP-hard problems was shown NP-hard. Ex. Consider the problem of finding the minimum number d of colors needed to color a planar graph G = ( V , E ). We have d = 0 if V is empty, d = 1 if E is empty ( V is not empty), and d = 2 if G is bipartite (neither V nor E is empty). 7
Determining whether d = 3 is NP-hard, if G is not bipartite and neither V nor E is empty. Since every planar graph is 4-colorable, an easy absolute approximation algorithm with | V* ( I ) − − V ( I )| ≤ ≤ 1 is as follows. − − ≤ ≤ Step 1. Return d = 0 if V is empty. Step 2. Return d = 1 if E is empty. Step 3. Return d = 2 if G is bipartite. Step 4. Return d = 4. The time complexity of the algorithm is dominated by Step 3, which takes O (| V | + | E |) time. 8
Ex. Consider the following NP-hard problem, which is a restricted subproblem of the well known bin packing problem. “Given two disks, each of capacity c , and n programs with storage requirements l 1 , l 2 , …, l n , respectively, determine the maximum number of programs that can be stored in the two disks (no program stored in two disks).” There is an O ( n log n ) time absolute approximation algorithm with | V* ( I ) − − V ( I )| ≤ ≤ 1 as follows − − ≤ ≤ Step 1. Arrange the programs in a nondecreasing order of l i ’s. Step 2. Examine the programs in the sorted order and assign them to the first disk if it has enough space, and to the second disk else, until no further assignment is possible. 9
For example, if n = 4, ( l 1 , l 2 , l 3 , l 4 ) = (2, 4, 5, 6), and c = 10, then the first two programs are stored in the first disk and the third program is stored in the second disk. For the example, an optimal solution is to store the first and third (or fourth) disks in one disk and the other two in the other disk. ♣ ♣ Proof of | V* ( I ) − − V ( I )| ≤ ≤ 1 ♣ ♣ − − ≤ ≤ Let p be the maximum number of programs stored in a disk of capacity 2 c , which happens when programs are stored in a nondecreasing order of l i ’s. ⇒ V* ( I ) ≤ ≤ p ≤ ≤ Assume that the p programs stored in the disk have storage requirements l 1 ≤ ≤ l 2 ≤ ≤ … ≤ ≤ l p , and ≤ ≤ ≤ ≤ ≤ ≤ p' ∑ p’ is the greatest index with l ≤ c . ≤ ≤ ≤ i i = 1 10
p − 1 p = ∑ = ∑ l l Since ≤ ≤ ≤ ≤ ≤ ≤ c , we have V ( I ) ≥ ≤ ≤ ≥ p − ≥ ≥ − − 1 − i i i p'+ 1 i p'+ 2 (i.e., store the first p’ programs in the first disk and the ( p’ + 1)th to ( p − − 1)th programs to the − − second disk). Therefore, | V* ( I ) − − V ( I )| ≤ ≤ 1. − − ≤ ≤ When k ≥ ≥ 2 disks are used, | V* ( I ) − − V ( I )| ≤ ≤ k − − 1 ≥ ≥ − − ≤ ≤ − − can be proved similarly. 11
• NP-Hardness of Absolute • • • Approximation Ex. 0/1 Knapsack Instance : A finite set U = { u 1 , u 2 , …, u n }, ∈ Z + a “size” s ( u i ) ∈ and a “value” ∈ ∈ ∈ Z + v ( u i ) ∈ for each u i ∈ ∈ U , and a ∈ ∈ ∈ ∈ ∈ Z + . size constraint b ∈ ∈ ∈ Question : What is the subset U’ ⊆ ⊆ U such that ⊆ ⊆ ∑ ∑ s u ≤ ≤ b and v u is ( ) ≤ ≤ ( ) i i u U' u U' ∈ ∈ ∈ ∈ ∈ ∈ ∈ ∈ i i maximized ? Π Π : the problem of designing a polynomial-time Π Π absolute approximation algorithm for 0/1 Knapsack. We show below that Π Π is NP-hard. Π Π 12
It suffices to show that if there exists a polynomial- time absolute approximation algorithm for 0/1 Knapsack, then 0/1 Knapsack can be solved in polynomial time (i.e., 0/1 Knapsack ∝ ∝ Π Π ). ∝ ∝ Π Π Suppose that A is a polynomial-time absolute approximation algorithm for 0/1 Knapsack with | V* ( I ) − − V ( I )| ≤ ≤ k , where k is a constant. − − ≤ ≤ � Let I be any instance of 0/1 Knapsack, and I be the instance of 0/1 Knapsack that is obtained by multiplying each “value” (i.e., v ( u i )) of I by k + 1. � ) − � )| is a multiple of k + 1. ⇒ (1) | V* ( I ⇒ ⇒ ⇒ − V ( I − − � (2) I and I have the same optimal solution (i.e., the same subset U’ ) and � ) = ( k + 1) V* ( I ). V* ( I 13
� , we have When applying A to I � ) − � )| ≤ | V* ( I − V ( I ≤ k , − − ≤ ≤ � ) = V* ( I � ). which together with (1) assures V ( I � ⇒ ⇒ ⇒ ⇒ A can generate an optimal solution for I (and hence an optimal solution for I ). For example, consider I as follows : U = { u 1 , u 2 , u 3 }, ( v ( u 1 ), v ( u 2 ), v ( u 3 )) = (1, 2, 3), ( s ( u 1 ), s ( u 2 ), s ( u 3 )) = (50, 60, 30), and b = 100, for which U’ = { u 2 , u 3 } is the optimal solution and V* ( I ) = 5. � When I changes ( v ( u 1 ), v ( u 2 ), v ( u 3 )) to (1 × × 5, 2 × × 5, 3 × × 5) = (5, 10, 15), the optimal × × × × × × � ) = 5 × U’ remains the same, but V* ( I × 5 = 25. × × � ) − � )| ≤ If A can guarantee | V* ( I − V ( I ≤ 4, then A − − ≤ ≤ � ) = 25 and output U’ = would compute V ( I � , which is also optimal for I . { u 2 , u 3 } for I 14
Ex. Clique Instance : An undirected graph G = ( V , E ). Question : What is the size of a maximum clique of G ? Π : the problem of designing a polynomial-time Π Π Π absolute approximation algorithm for Clique. In order to show that Π Π is NP-hard, it suffices Π Π to show that if there exists a polynomial-time absolute approximation algorithm A for Clique, then Clique can be solved in polynomial time. Assume that A guarantees | V* ( I ) − − V ( I )| ≤ ≤ k for − − ≤ ≤ each instance I of Clique, where k is a constant. 15
Recommend
More recommend