You are on page 1of 10

Bin Packing (1-D)

Fittings things neatly and efficiently inside a


large container

Example:
Groups 3, 1, 6, 4, 5, 2 of people need to fit into a
minibus of capacity of 7 but must stay
together in their groups.

Find the no of minibuses to pack them


efficiently so that each group stays together.
Bin Packing (1-D)

Four things need to know.


1. How to find the lower bound
2. How to perform the first fit algorithm
3. How to perform the first fit-decreasing algorithm
4. How to perform the full-bin packing algorithm
Bin Packing

Lower bound:

Add up the groups and divide by the minibus


size to obtain the minimum no of buses.

3+1+6+4+5+2/7
=21/7
=3.
So, lower bound is 3.
Bin Packing- example #2

Lower bound:

Add up the groups and divide by the minibus


size to obtain the minimum no of buses.

3+1+6+4+5+2/7
=21/7
=3.
So, lower bound is 3.
Bin Packing- example #2

Bin Packing Problem The bins;


(capacity 1)

1 ……

.5 .7 .5 .2 .4 .2 .5 .1 .6
.2 .4 .2 .1
.5 .5 .5 .6
.7

Items to be packed
Bin Packing- example #2

Bin Packing Problem

1 ……

.5 .7 .5 .2 .4 .2 .5 .1 .6

Optimal Packing
.1
.5 .2
.5
.6 N0 = 4
.5 .7
.4
.2
Next Fit Packing
Algorithm
Bin Packing Problem
.5 .7 .5 .2 .4 .2 .5 .1 .6
.1
.5 .2
.5
.6 N0 = 4
.5 .7
.4
.2

Next Fit Packing Algorithm


.2 .1
.2
.7 .6
.5 .5 .4 .5

Ν N=6
2
Ν 0
First Fit Packing
Algorithm
.5 .7 .5 .2 .4 .2 .5 .1 .6
Next Fit Packing Algorithm

.2 .1
.2
.7 .6
.5 .5 .4 .5

First Fit Packing Algorithm


.1
.5 .2

.2
.7 .6
.5 .4 .5

N=5
Ν
 1.7 (Proof omitted)
Ν0
First Fit Packing
Algorithm

Arrange the data in decreasing order

.7 .6 .5 .5 .5 .4 .2 .2 .1
First Fit-decreasing
Packing Algorithm
.7 .6 .5 .5 .5 .4 .2 .2 .1
Next Fit Packing Algorithm

.2 .1
.2
.7 .6
.5 .5 .4 .5

First Fit -Decreasing Packing Algorithm


.1 .4
.2
.2 .5
.5
.6
.7 .5 .5

N=4

You might also like