Download presentation
Presentation is loading. Please wait.
1
PTAS for Bin-Packing
2
Special Cases of Bin Packing
1. All item sizes smaller than Claim 1: Proof: If then So assume Therefore:
3
But for since and Therefore:
4
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
5
Number of different such tuples:
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)
6
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 bin subset If entire set is packed – done o/w continue to next step
7
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:
8
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.
9
Fix k (we will later decide the value of k)
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’.
10
EXAMPLE: G G G G4 I: I’: 4. Find OPT(I’) (by Claim 2).
11
Lemma: OPT(I’) ≤ OPT(I) Proof: Consider I” constructed as: Discard
For change every element in group to smallest. EXAMPLE: G G G G4 I: I’: Clearly OPT(I’) ≤ OPT(I) (since I” has less elements and they are smaller)
12
OPT(I’) ≤ 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)
13
Algorithm Running Time:
Approximation Factor: PA(I) ≤ OPT(I)+k NOW CHOOSE: Therefore: (1+ε) OPT(I)+1
14
What about the time? But for all i, so: Thus Algorithm Running Time: Since ε is fixed, this is a polynomial.
15
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.
16
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.