Title: Packing Rectangles into Bins
1Packing Rectangles into Bins
- Nikhil Bansal (CMU)
- Joint with Maxim Sviridenko (IBM)
2Problem
- Given Collection of rectangles (by height,
width) - Goal Pack in min of unit square bins
- Rectangles parallel to bin edges
- Cannot be rotated
Rectangles
4
5
3
6
1
2
6
6
1
1
2
Bins
2
3
3
4
4
5
5
3Problem
- Given Collection of rectangles (by height,
width) - Goal Pack in min of unit square bins
- Rectangles parallel to bin edges
- Cannot be rotated
Rectangles
4
5
3
6
1
2
3
3
1
1
6
2
2
6
2-d Bin Packing
4
4
5
5
4Motivation
- 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
51-d Bin Packing
- Special case of 2-d packing
- 1-dim bin packing
- Collection of intervals with length in 0,1,
- Pack into min of unit bins
4
3
!
2
2
4
1
1
3
61-d Bin Packing
- Special case of 2-d packing
- 1-dim bin packing
- Collection of intervals with length in 0,1,
- Pack into min of unit bins (NP-Hard)
4
3
!
2
2
4
1
1
3
7Approximation algorithms
- An algorithm is a ? approximation (? gt 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
? gt 0. -
- E.g., Running Time
81-d bin packing Inapproximability
- Cannot get a poly time approximation lt 3/2
- Partition problem (NP-Hard) Given s1,,sn , S
s1s2,,sn - 9 a subset of elements that sums to exactly
S/2 ?
s1
s6
s2
s5
s3
s4
S/2
S/2
But maybe can get Opt 1 in poly time ?
9Asymptotic 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
10Outline
- Introduction
- APTAS for 1-d packing de la Vega, Lueker 81
- Results for 2-d packing
- Conclusions
11APTAS 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
12Main idea
- Simplify Original instance I -gt I
-
- I easy to solve
- Solutions of I and I close (within 1?)
-
13Ideas applied to 1-d packing
- ? Small ? Big
- 1) I ! I with 1/?2 different big sizes solns.
within 1? -
- 2) I easy If k O(1) different big sizes, can
get Opt k
141-d Rounding to a simpler instance
I
0
1
Various object sizes
151-d Rounding to a simpler instance
- Ib I restricted to bigs.
Let b of bigs (i.e. ?)
Ib
0
1
?
1
Various object sizes
161-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
?
171-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 Ib Ignore largest b ?2 objects.
Round up sizes to smallest
size in next higher group
Ib
0
1
?
181-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 Ib Ignore largest b ?2 objects.
Round up sizes to smallest
size in next higher group
Ib
0
1
?
Alg(Ib) Alg(Ib)
191-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 Ib Ignore largest b ?2 objects.
Round up sizes to smallest
size in next higher group
Ib
0
1
?
Alg(Ib) Alg(Ib) b ?2
201-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 Ib Ignore largest b ?2 objects.
Round up sizes to smallest
size in next higher group
Ib
0
1
?
Alg(Ib) Alg(Ib) Alg(Ib) b ?2
211-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 Ib Ignore largest b ?2 objects.
Round up sizes to smallest
size in next higher group
Ib
0
1
?
Alg(Ib) Alg(Ib) Alg(Ib) b ?2
Opt(Ib) b ? ) b ?2 ? Opt(Ib)
221-d Solving the few and big case
- Ib 1/?2 different sizes gt ?. 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 nj 8 j 2
1,..,1/?2 - xi 0 8 i, xi 2 Z
IP for Ib
231-d Few and Big using LP
- Minimize ?i xi
- ?i cij xi nj 8 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 -gt 18)
- Adds configurations (1/?2)1/? O(1)
- In fact, adds 1/?2 (non-zero xis in basic
soln)
241-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
- If no 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
251-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.
26Outline
- Introduction
- APTAS for 1-d packing de la Vega, Lueker 81
- Results for 2-d packing
- Conclusions
27Outline
- Introduction
- APTAS for 1-d packing de la Vega, Lueker 81
- Results for 2-d packing
- Square packing problem
- General rectangle packing problem
- Conclusions
28Square Packing Problem
- Given a collection of squares (hypercubes for
dgt2) - Pack into min of unit bins.
1
1
1
4
2
2
!
2
5
3
3
5
4
5
4
6
6
7
7
6
3
7
29Square 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(?) )
30Outline
- 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
31O(1) Approximation Square Packing
- Opt Total area of 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
32O(1) approximation Square Packing
- If big (length 1/3), put in its own bin.
- Use 1/9th area.
Big uses gt 1/9th area
Need a way to pack small objects efficiently.
33Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
a
b
34Shelf 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
3
2
b
35Shelf 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
3
2
b
36Shelf 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
37Shelf 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
38Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
- Algorithm Decreasing size shelf packing.
Wasted Space s(ab)
a
b
39Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
- Algorithm Decreasing size shelf packing.
Wasted Space s(ab) Right side At most s a
a
b
40Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
- Algorithm Decreasing size shelf packing.
Wasted Space s(ab) Right side At most s
a Top s16 b
a
b
41Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
- Algorithm Decreasing size shelf packing.
Wasted Space s(ab) Right side At most s
a Top s16 b Shelf 1 (s1 s3) b
a
b
42Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
- Algorithm Decreasing size shelf packing.
Wasted Space s(ab) Right side At most s
a Top s16 b Shelf 1 (s1 s3) b Shelf 2 (s4
s8) b
a
b
43Shelf Packing
- Given a rectangular region of size a b
- Goal Pack squares of length s
- Algorithm Decreasing size shelf packing.
Wasted Space s(ab) 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
44Square Packing Packing Smalls
- If all squares s, waste in a b region
s(ab) - If ab1, s 1/3 ) Waste 2/3
- O(1) approximation follows.
45Outline
- 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
46Square Packing
0
1
Squares with various lengths
47Square Packing
G0
G1
Gm
G1/? -1
?m1
?01
?1
?m
?1/?
?2
0
48Square Packing
G0
G1
Gm
G1/? -1
?m1
?01
?1
?m
?1/?
?2
0
Small
Medium
Big
Gm ?m1,?m) be such that area ? (total
area)
49Square Packing
G0
G1
Gm
G1/? -1
?m1
?01
?1
?m
?1/?
?2
0
Small
Medium
Big
Gm ?m1,?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.
50Square Packing
G0
G1
G1/? -1
?m1
?01
?1
?m
?1/?
?2
0
Small
Big
Gm ?m1,?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.
51Square Packing
G0
G1
G1/? -1
?m1
?01
?1
?m
?1/?
?2
0
Small
Big
Gm ?m1,?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.
- ?0 1 , ?i ? ?i-12 (1,?,?3,?7,)
52Square Packing
-
- Packing bigs Rounding technique similar to 1-d
case, - ! O(1) different lengths
- Opt(Ib) Opt(Ib) Opt(Ib)/(1-?)
- LP to find close to optimum packing of Ib
G0
G1
G1/? -1
?m1
?01
?1
?m
?1/?
?2
0
Small
Big
53Square Packing Filling in the smalls
Bigs use ¼ Opt bins What about smalls?
54Square Packing Filling in the smalls
Divide the free space into rectangular
gaps. Fill smalls in gaps using decreasing size
shelf algorithm
Rectangular Gaps
55Square Packing Filling in the smalls
Small ?m1 , big ?m
bigs 1/?m2, gaps 4/?m2 Recall Packing
s in a b wastes at most s(ab) ab 2,
s ?m1 ? ?m2 Total waste 2 s gaps
2 ? ?m2 4/?m2
8 ?
Rectangular Gaps
56Square Packing
- If no new bins opened for smalls, done.
- If we do, waste in each bin (except maybe last)
is O(?), hence done by area lower bound. - Thm ALG(I) (1?) Opt(I)
- Generalizes to dgt2 dimensions with few
modifications.
57Square Packing Technique Summary
- Partition into big, medium, small
- Ignore mediums
- Gap between big and small
- Ideas from 1-d packing smalls with low waste
58Outline
- Introduction
- APTAS for 1-d packing de la Vega, Lueker 81
- Results for 2-d packing
- Square packing problem
- General rectangle packing problem
- Conclusions
59Rectangle packing
- Problem Pack rectangles into min of unit bins.
- (no rotation)
- 2.125 approximation Chung, Garey, Johnson
82 - 2? Kenyon,
Remila 96 - Best known 1.691 ? Caprara 02
- Prior to our work APTAS open
60Results for Rectangle Packing
- Main Thm No APTAS exists for 2-d rectangle
packing. - Hence for dgt2.
- Proof Lets skip it.
61Conclusion and Open Problems
- Impossibility of APTAS for rectangle packing
- APTAS for square packing
- 1-d Case (1?) Opt O(1/?2) de la Vega,
Lueker 81 - Opt O(log2(Opt))
Karmarkar, Karp 82 - Opt O(1) ?
- d 2 1.691 ? Caprara 02
- d gt 2 1.691d Csirik, Van Vliet
93 - ?(cd) lower bounds for d-dim bin packing ?
62Results for Rectangle Packing
- Main Thm No APTAS exists for 2-d rectangle
packing. - Hence for dgt2.
- Thm Kenyon, Correa 04
- APTAS if allow Alg to pack in (1?) (1?)
size bins - Alg(I) (1?) Opt(I)
f(?) - Thm APTAS if allow Alg to pack in 1 (1?)
size bins.
63Hardness
- 2-d Vector Packing Problem
- Given 2-d vectors (equivalently rectangles). In
each bin, - ? widths 1 , and ? heights 1.
Valid
Invalid
64Hardness of Vector Packing
- Xx1,,xn, Yy1,,yn, Zz1,,zn, T
t1,,tn - Each gtb/5 and lt b/3
- Goal Max. number of disjoint 4-tuples that sum
to exactly b - SNP-Hard 9 ? Cannot distinguish if n such
tuples or (1-?) n - Woegingers construction 97
- Xi (.2 xi/5b, .3 xi/5b) Yi
(.2 yi/5b, .3 yi/5b) - Zi (.2 zi/5b, .3 zi/5b) Ti
(.2 ti/5b, .3 ti/5b) - Observation All these fit in a bin iff
xiyjzktl b
65Rectangle Packing
- 2 rectangles for each object in X,Y,Z,T
- (Thin, Tall) and (Fat, Short) for each object
in X,Y,Z - (Fat, Tall) and (Thin, Short) for each object
in T
Details to show that other patterns do not work