170 likes | 372 Views
PTAS for Bin-Packing. Special Cases of Bin Packing. 1. All item sizes smaller than Claim 1: Proof: If then So assume Therefore:. But for since and Therefore:. 2. Assume that there are only k different sizes ( k fixed).
E N D
Special Cases of Bin Packing 1. All item sizes smaller than Claim 1: Proof: If then So assume Therefore:
But for since and Therefore:
2.Assume that there are only k different sizes (k fixed). Claim 2: Optimum number of bins can be found in time: Proof: For every subset of items compute the optimal number of bins it can be packed in. Total number of subsets is Why? Sort items by size: size size size
Denote a subset by a k-tuple of the number of elements of each size in the subset. Number of different such tuples: Compute optimal number of bins for each subset using dynamic programming. Find subsets that can be packed in 1 bin Find subsets that can be packed in 2 bins … Find subsets that can be packed in OPT bins (Note OPT can not exceed n)
Number of values per iteration: Number of iterations: n IMPLEMENTATION: 1.Sort subsets by sums of sizes. Those with sum not exceeding 1 are packed in a single bin. Call them 1-bin subsets. 2.For all pairs of 1-bin subsets, consider their union. Every union that is not a 1-bin subset is a 2-bin subset. If entire set is packed – done. o/w continue to next step. . . .
i+1. For all pairs consisting of a 1-bin subset and an i-bin subset, consider their union. If it is not an i-bin subset or less , then it is a (i+1)-bin subset. If entire set is packed – done. o/w continue to next step. . . . Time: We consider all pairs at every step, thus time per step. At most OPT steps. OPT Conclude:
3. Conclude: Given and Assume that all items have size then (By claim 1). 4.Assume that all items have size Claim 2: There exists a packing algorithm PA for which Proof: Consider the following approximation algorithm.
Fix k (we will later decide the value ofk) 1.Sort I in non-decreasing order. Split into groups of k elements each. 2. Pack group G1 in at most k bins. 3. Change all numbers in to largest number in group. Call new item set I’.
EXAMPLE: G1 G2 G3 G4 I:10 9 8 7 7 6 6 6 5 3 2 I’: 7 7 7 6 6 6 3 3 4. Find OPT(I’) (by Claim 2).
Lemma:OPT(I’) ≤ OPT(I) Proof: Consider I” constructed as: Discard For change every element in group to smallest. EXAMPLE: G1 G2 G3 G4 I:10 9 8 7 7 6 6 6 5 3 2 I”: 8 8 8 6 6 6 5 5 5 Clearly OPT(I”) ≤ OPT(I) (since I” has less elements and they are smaller)
OPT(I’) ≤ OPT(I”) • Why? • I’ may have less elements. ( , and all other sets are equal sized in both) • I’ has smaller total sum. • ( ) • Conclude: • OPT(I’) ≤ OPT(I“) ≤ OPT(I)
Algorithm Running Time: Approximation Factor: PA(I) ≤ OPT(I)+k NOW CHOOSE: Therefore: Approximation Factor: (1+ε) OPT(I)+1
What about the time? But for all i, so: Thus Algorithm Running Time: Since ε is fixed, this is a polynomial.
Algorithm for the General Case: • Split items into two sets: small (≤ε/2) and large (>ε/2). • 2. Handle large items as in Claim 4. • 3. Use FF to pack small items into remaining spaces of large item bins. When all such space is used, open new bins using FF. • Time: Clearly polynomial. • Approximation Factor: • Case 1: All large item bins are filled, and new ones opened. • Case 2: Not all large item bins are filled.
Case 1: The situation is: This is the case of claim 1, so approximation is (1+ε) OPT(I)+1 Case 2: Let IL be the set of large items. The number of bins produced by our algorithm is: OPT(I’)+k ≤ =(1+ε) OPT(I)+1