0% found this document useful (0 votes)
27 views6 pages

Bin Packing

The document discusses the Bin Packing Problem, focusing on greedy approaches for both online and offline scenarios. It describes methods such as Next Fit, First Fit, Best Fit for online packing, and First Fit Decreasing for offline packing, providing examples and optimal solutions for each method. The goal is to efficiently pack items into the fewest bins possible based on their sizes.

Uploaded by

rsinglame24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views6 pages

Bin Packing

The document discusses the Bin Packing Problem, focusing on greedy approaches for both online and offline scenarios. It describes methods such as Next Fit, First Fit, Best Fit for online packing, and First Fit Decreasing for offline packing, providing examples and optimal solutions for each method. The goal is to efficiently pack items into the fewest bins possible based on their sizes.

Uploaded by

rsinglame24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like