© 2010 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property. Bin Packing: From Theory to Experiment and Back Again David S. Johnson AT&T Labs – Research
Applications Packing commercials into station breaks Packing files onto floppy disks Packing MP3 songs onto CDs Packing IP packets into frames, SONET time slots, etc. Packing telemetry data into fixed size packets Standard Drawback: Bin Packing is NP-complete
OUTLINE Worst-Case Performance Average-Case Performance –Classical Models Experiments Theory –Discrete Distributions Theory Experiments Theory
First Fit (FF): Put each item in the first bin with enough space Best Fit (BF): Put each item in the bin that will hold it with the least space left over First Fit Decreasing, Best Fit Decreasing (FFD,BFD): Start by reordering the items by non-increasing size.
Worst-Case Bounds Theorem [Ullman, 1971]. For all lists L, BF(L), FF(L) ≤ (17/10)OPT(L) + 3. Theorem [Johnson, 1973]. For all lists L, BFD(L), FFD(L) ≤ (11/9)OPT(L) + 4. (Note 1: 11/9 = …) (Note 2: These bounds are asymptotically tight.)
Lower Bounds: FF and BF ½ + ½ - OPT: N bins ½ - ½ + FF, BF: N/2 bins + N bins = 1.5 OPT
Lower Bounds: FF and BF 1/2 + 1/3 + OPT: N bins ½ + FF, BF: N/6 bins + N/2 bins + N bins = 5/3 OPT 1/6 - 2 1/3 +
Lower Bounds: FF and BF 1/2 + 1/3 + OPT: N bins 1/7 + 1/ , etc. 1/43 + , FF, BF = N(1 + 1/2 + 1/6 + 1/42 + 1/ … ) ( ) OPT
“Improving” on FF and BF
“Improving” on FFD and BFD
Average-Case Performance
Progress?
Progress: Faster Computers Bigger Instances
Definitions
Definitions, Continued
Theorems for U[0,1]
Proof Idea for FF, BF: View as a 2-Dimensional Matching Problem
Distributions U[0,u] Item sizes uniformly distributed in the interval (0,u], 0 < u < 1
Average Waste for BF under U(0,u]
Measured Average Waste for BF under U(0,.01]
Conjecture
FFD on U(0,u] Experimental Results from [Bentley, Johnson, Leighton, McGeoch, 1983] N = FFD(L) – s(L ) u =.6 u =.5 u =.4
FFD on U(0,u], u 0.5
FFD on U(0,u], 0.5 u 1
OUTLINE Worst-Case Performance Average-Case Performance –Classical Models Experiments Theory –Discrete Distributions Theory Experiments Theory
Discrete Distributions
Courcoubetis-Weber
y x z (0,0,0) (2,1,1) (0,2,1) (1,0,2)
Courcoubetis-Weber Theorem
A Flow-Based Linear Program
Theorem [Csirik et al. 2000] Note: The LP’s for (1) and (3) are both of size polynomial in B, not log(B), and hence “pseudo-polynomial”
/3 1 2/3 Discrete Uniform Distributions U{3,4} U{6,8} U{12,16}U(0,¾]
Theorem [Coffman et al. 1997] (Results analogous to those for the corresponding U(0,u])
Experimental Results for Best Fit 0 ≤ u ≤ 1, 1 ≤ j ≤ k = 51 Averages of 25 trials for each distribution, N = 2,048,000
Average Waste under Best Fit (Experimental values for N = 100,000,000 and 200,000,000) [GJSW, 1993] [KRS, 1996] Holds for all j = k-2
Theorem [Kenyon & Mitzenmacher, 2000]
Average w BF (L)/s(L) for U{j,85}
Average w BFD (L)/s(L) for U{j,85}
Averages on the Same Scale
The Discrete Distribution U{6,13}
“Fluid Algorithm” Analysis: U{6,13} Size = Amount = β β β β β β Bin Type = Amount = 6 6 β/ β/3 β/6 β/ β/8 β/ ¾β¾β
Expected Waste
Theorem [Coffman, Johnson, McGeoch, Shor, & Weber, ]
U{j,k} for which FFD has Linear Waste j k
Minumum j/k for which Waste is Linear k j/k
Values of j/k for which Waste is Maximum k j/k
Waste as a Function of j and k (mod 6)
K = 8641 =
Pairs (j,k) where BFD beats FFD k j
Pairs (j,k) where FFD beats BFD k j
Beating BF and BFD in Theory
Plausible Alternative Approach
The Sum-of-Squares Algorithm (SS)
SS on U{j,100} for 1 ≤ j ≤ 99 j SS(L)/s(L) BF for N = 10M SS for N = 1M SS for N = 100K SS for N = 10M
Discrete Uniform Distributions II
j h
K = 101 j h
K = 120 j h
j h K = 100 h = 18
Results for U{18..j,k} j A(L)/s(L) BF SS OPT
Is SS Really this Good?
Conjectures [Csirik et al., 1998]
Why O(log n) Waste?
Theorem [Csirik et al., 2000]
Proving the Conjectures: A Key Lemma
Linear Waste Distributions
Good News
SS F for U{18.. j,100}
Handling Unknown Distributions --
SS * for U{18.. j,100}
Other Exponents
Variants that Don’t Always Work B = 10, S = {1,3,4,5,8}, p(1) = p(3) = p(5) = 1/4, p(4) = p(8) = 1/8. Distribution = (1/8) ( {8,1,1} + {4,3,3} + {5,5} )
Offline Packing Revisited: The Cutting-Stock Problem
Gilmore-Gomory vs Bin Packing Heuristics
Some Remaining Open Problems