BP
BP
Bin Packing
UCSB TG
CS 130B ST-1
0.1
0.5 0.8
0.7
0.4
0.2 0.3
B1 B2 B3 B4 B5
Next Fit
0.1
0.3
0.4
0.8
0.7
0.5
0.2
B1 B2 B3
Optimal Packing
UCSB TG
CS 130B ST-2
Theorem 10.2
UCSB TG
CS 130B ST-3
UCSB TG
CS 130B ST-4
B1 B2 BN BN+1
Optimal Packing
B1 B2 B2N1 B2N
Next Fit
OP T = N + 1 = M
Therefore, N = M 1
Solution SOL = 2N = 2M 2.
UCSB TG
CS 130B ST-5
0.1
0.3
0.5 0.8
0.7
0.4
0.2
B1 B2 B3 B4
First Fit
0.1
0.3
0.4
0.8
0.7
0.5
0.2
B1 B2 B3
Optimal Packing
UCSB TG
CS 130B ST-6
Better Implementation
UCSB TG
CS 130B ST-7
Example
Bin B1 B2 B3 B4 B5 B6 B7 B8
R. Cap. .3 .4 .32 .45 .46 .47 .32 48
i: bin index
RC: Remaining Capacity
i , RC
BRC: Best Remaining Capacity in subtree
BRC
5 , .46
.48
3 , .32 7 , .32
.45 .48
1 , .3
.3
Item Size Goes to Bin
s <= .3 B1
.3 < s <= .4 B2
UCSB TG
CS 130B ST-8
Upper Bounds
UCSB TG
CS 130B ST-9
1/7+eps
...
1/3+eps
1/7+eps 1/2+eps
1/3+eps
1/7+eps
First Fit
1/7+eps
1/3+eps
1/2+eps
B1 ... B6M
Optimal Packing
UCSB TG
CS 130B ST-10
0.1 0.3
0.5 0.8
0.7
0.4
0.2
B1 B2 B3 B4
Best Fit
0.1
0.3
0.4
0.8
0.7
0.5
0.2
B1 B2 B3
Optimal Packing
UCSB TG
CS 130B ST-11
UCSB TG
CS 130B ST-12
UCSB TG