Efficient 2-D Bin Packing of Rectangles: An Approximation Approach
This paper explores the challenge of packing a collection of rectangles, defined by their height and width, into the minimum number of unit square bins without rotation. We discuss various applications of bin packing, from newspaper ad placement to truck loading and memory allocation. The focus is on approximation algorithms, particularly for 1-D bin packing, and their applicability to the 2-D case. We present results from the Approximation Polynomial Time Scheme (APTAS) and examine the complexity of the packing problem, including NP-hard partitions and possible solutions.
Efficient 2-D Bin Packing of Rectangles: An Approximation Approach
E N D
Presentation Transcript
Packing Rectangles into Bins Nikhil Bansal (CMU) Joint with Maxim Sviridenko (IBM)
Problem Given: Collection of rectangles (by height, width) Goal : Pack in min # ofunit square bins • Rectangles parallel to bin edges • Cannot berotated Rectangles 4 5 3 6 1 2 6 6 1 1 2 2 Bins 3 3 4 4 5 5
Problem Given: Collection of rectangles (by height, width) Goal : Pack in min # ofunit square bins • Rectangles parallel to bin edges • Cannot be rotated Rectangles 4 5 3 6 1 2 3 3 1 1 2 2 6 6 2-d Bin Packing 4 4 5 5
Motivation Many Applications: Real World packing of (real world) bins • Placing ads in newspapers • Cloth cutting: Minimizing sheets to buy • Truck Loading • Memory allocation in paging systems • …
1-d Bin Packing Special case of 2-d packing 1-dim bin packing: Collection of intervals withlength in [0,1], Pack into min # of unit bins 4 3 2 ! 2 4 1 1 3
1-d Bin Packing Special case of 2-d packing 1-dim bin packing: Collection of intervals withlength in [0,1], Pack into min # of unit bins (NP-Hard) 4 3 2 ! 2 4 1 1 3
Approximation algorithms An algorithm is a approximation ( > 1) if • runs in polynomial time • Value of solution · Opt Opt: value of optimum solution Polynomial time approximation scheme (PTAS) is a family of 1+ approximation algorithms for every > 0. E.g., Running Time
1-d bin packing: Inapproximability Cannotget a poly time approximation < 3/2 Partition problem (NP-Hard): Given s1,…,sn , S= s1+s2,…,sn 9 a subset of elements that sums to exactly S/2 ? s1 s2 s3 s4 s5 s6 S/2 S/2 But maybe can getOpt + 1 in poly time ?
Asymptotic PTAS Alg · (1+) Opt + f() f() depends only on e.g. (1/)(1/) For 1-d bin packing: Alg · (1+) Opt + O(1/2) [de la Vega, Lueker 81]
Outline • Introduction • APTAS for 1-d packing [de la Vega, Lueker 81] • Results for 2-d packing • Conclusions
APTAS for 1-d bin packing Theorem:[de la Vega, Lueker 81] Alg(I) · Opt(I)/(1-) + 1/2 ¼ Opt(I) (1+) + f() 4 3 2 ! 2 4 1 1 3
Main idea Simplify Original instance I -> I’ • I’: easy to solve • Solutions of I and I’ close (within 1+)
Ideas applied to 1-d packing ·: Small ¸: Big 1) I ! I’ with 1/2different big sizes & solns. within 1+ 2) I’ easy: If k= O(1) different big sizes, can get Opt + k
1-d: Rounding to a simpler instance I 0 1 Various object sizes
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs (i.e. ¸) Ib 0 1 1 Various object sizes
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs (i.e. ¸) Partition big into 1/2 groups, each group has b¢2 objects Ib (here b¢2 =3) 0 1
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs(i.e. ¸) Partition big into 1/2 groups, each group has b¢2 objects Ib 0 1 Instance I’b : Ignorelargest b ¢2 objects. Round up sizes to smallest size in next higher group I’b 0 1
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs (i.e. ¸) Partition big into 1/2 groups, each group has b¢2 objects Ib 0 1 Instance I’b : Ignorelargest b ¢2 objects. Round up sizes to smallest size in next higher group I’b 0 1 Alg(I’b) · Alg(Ib)
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs (i.e. ¸) Partition big into 1/2 groups, each group has b¢2 objects Ib 0 1 Instance I’b : Ignorelargest b ¢2 objects. Round up sizes to smallest size in next higher group I’b 0 1 Alg(Ib) · Alg(I’b) + b 2
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs (i.e. ¸) Partition big into 1/2 groups, each group has b¢2 objects Ib 0 1 Instance I’b : Ignorelargest b ¢2 objects. Round up sizes to smallest size in next higher group I’b 0 1 Alg(I’b) · Alg(Ib) · Alg(I’b) + b 2
1-d: Rounding to a simpler instance Ib :I restricted to bigs. Let b = # of bigs (i.e. ¸) Partition big into 1/2 groups, each group has b¢2 objects Ib 0 1 Instance I’b : Ignorelargest b ¢2 objects. Round up sizes to smallest size in next higher group I’b 0 1 Alg(I’b) · Alg(Ib) · Alg(I’b) + b 2 Opt(Ib) ¸ b ) b 2· Opt(Ib)
1-d: Solving the “few and big” case I’b : 1/2 different sizes > . Call these s1,…,sk . Configuration: A way to pack a bin (Eg: C = [3 s1, 17 s3, 5 s18]) |Configurations| · (1/2)1/ = O(1) xi : # of bins with configuration i nj : # of objects of size sj in instance cij: # of objects of size sj in configuration i. Minimize i xi i cij xi¸ nj8 j 2 [1,..,1/2] xi¸ 0 8 i, xi2 Z IP for I’b
1-d: “Few and Big” using LP Minimize i xi i cij xi¸ nj8 j 2 [1,..,1/2] xi¸ 0 (Relaxed to be fractional) Clearly, LP (Ib’) · OPT(Ib’) xi could be fractional. Round up to next integer ( Eg: 17.34 -> 18) Adds ·# configurations = (1/2)1/ = O(1) In fact, adds · 1/2 (non-zero xi’s in basic soln)
1-d: Filling in the smalls So, Alg(Ib) · Opt(I)/(1-) + 1/2 Packing smalls: • In each bin, fill as many smalls as possible. • If bins not enough, open new bins to fill smalls. Proof: • Ifno new bins opened, done. • If new bins opened, all bins (except maybe last) filled 1- So, Alg(I) · Area(I)/(1-) + 1 · Opt(I)/(1-) + 1
1-d: Overview 0) Partition into small and big 1) Pack small objects later 2) Round large objects to O(1) sizes. Solve the “few and big” case almost optimally.
Outline • Introduction • APTAS for 1-d packing [de la Vega, Lueker 81] • Results for 2-d packing • Conclusions
Outline • Introduction • APTAS for 1-d packing [de la Vega, Lueker 81] • Results for 2-d packing • Square packing problem • General rectangle packing problem • Conclusions
Square Packing Problem Given a collection of squares (hypercubes for d>2) Pack into min # of unit bins. 1 1 1 4 2 2 ! 2 5 3 3 5 5 4 4 6 6 7 7 6 3 7
Square Packing: Previous Work 2-dim: 2.125 [Chung, Garey, Johnson 82] …… 1.454 [Epstein, van Stee 03] d-dim: (3/2)d[Coppersmith, Raghavan 89] …… 2-(2/3)d[Kohayakawa et al 02] We give an APTAS (i.e., Alg(I) · 1+ Opt(I) + f() )
Outline • Introduction • APTAS for 1-d packing [de la Vega, Lueker 81] • Results for 2-d packing • Square packing problem • O(1) Approximation • APTAS • General rectangle packing problem • Conclusions
O(1) Approximation: Square Packing Opt ¸ Total areaof squares in I. If we can use constant fraction of area in each bin )O(1) approximation. Eg: If use ¸ 1/100th area in each bin ) 100 approx
O(1) approximation: Square Packing If big (length ¸ 1/3), put in its own bin. Use ¸ 1/9th area. Big uses > 1/9th area Need a way to pack small objects efficiently.
Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s a b
Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. • Take squares in decreasing size • Place sequentially a 1 2 3 b
Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. • Take squares in decreasing size • Place sequentially • If next does not fit, • open a new shelf a 1 2 3 b
Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. • Take squares in decreasing size • Place sequentially • If next does not fit, • open a new shelf 4 a 8 1 3 b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. • Take squares in decreasing size • Place sequentially • If next does not fit, • open a new shelf a b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. Wasted Space · s(a+b) a b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. Wasted Space · s(a+b) Right side: At most s £ a a b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. Wasted Space · s(a+b) Right side: At most s £ a Top · s16 b a b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. Wasted Space · s(a+b) Right side: At most s £ a Top · s16 b Shelf 1: (s1 –s3) b a b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. Wasted Space · s(a+b) Right side: At most s £ a Top · s16 b Shelf 1: (s1 –s3) b Shelf 2: (s4 – s8) b … a b
9 16 4 8 1 3 Shelf Packing Given a rectangular region of size a £ b Goal: Pack squares of length · s Algorithm: Decreasing size shelf packing. Wasted Space · s(a+b) Right side: At most s £ a Top · s16 b Shelf 1: (s1 –s3) b Shelf 2: (s4 – s8) b …. Adding all, at most (s1-s16) b a b
Square Packing: Packing Smalls If all squares · s, waste in a £ b region · s(a+b) If a=b=1, s · 1/3 )Waste · 2/3 O(1) approximation follows.
Outline • Introduction • APTAS for 1-d packing [de la Vega, Lueker 81] • Results for 2-d packing • Square packing problem • O(1) Approximation • APTAS • General rectangle packing problem • Conclusions
Square Packing 0 1 Squares with various lengths
Square Packing G1/ -1 Gm G1 G0 m+1 1/ … m … 2 1 0=1 0
Square Packing G1/ -1 Gm G1 G0 m+1 1/ … m … 2 1 0=1 0 Small Medium Big Gm =[ m+1,m)be such that area · (total area)
Square Packing G1/ -1 Gm G1 G0 m+1 1/ … m … 2 1 0=1 0 Small Medium Big Gm =[ m+1,m)be such that area · (total area) Pack medium in separate bins using O(1) approx Adds at most O() to the number of bins. Ignore medium jobs from now on.
Square Packing G1/ -1 G1 G0 m+1 1/ … m … 2 1 0=1 0 Small Big Gm =[ m+1,m)be such that area · (total area) Pack medium in separate bins using O(1) approx Adds at most O() to the number of bins. Ignore medium jobs from now on.