Bin Packing Problem
Approximate Bin Packing using Greedy
Approaches
Problem: Pack n items into as few bins as possible; each item has a
size of
0 < s_i <=1
1) online: make decisions as the items arrive
2) offline: make decisions with knowledge of all items
Online
Next Fit: Each new item is placed in current bin if possible, otherwise start a
new bin
Consider: 0.3, 0.8, 0.9, 0.1, 0.2, 0.7
0.1 0.7
0.3 0.8 0.9 0.2
1
First Fit - Place item in first available bin
Consider: 0.3, 0.8, 0.9, 0.1, 0.2, 0.7
0.2
0.1 0.8 0.9 0.7
0.3
Best Fit - Place item into tightest Fit
Consider: 0.3, 0.8, 0.9, 0.1, 0.2, 0.7
For this data, we produce an optimal solution
0.7 0.2 0.1
0.8 0.9
0.3
Offline
First Fit Decreasing - sort largest to smallest, then place each item in the First bin that will
hold it
Sorted: 0.9, 0.8, 0.7, 0.3, 0.2, 0.1
For this data, this is an optimal solution
0.1 0.2 0.3
0.8 0.7
0.9