Download presentation
Presentation is loading. Please wait.
2
Bin packing – First fit algorithm
A B C D E F Each block will be fitted into the first bin that has room for it. 6 5 4 3 3 3 2 2 1
3
Bin packing – First fit algorithm
4 A B C D E F The first block fits into the first bin 6 5 3 3 3 2 2 1
4
Bin packing – First fit algorithm
1 4 A B C D E F The second block fits in the first bin 6 5 3 3 3 2 2
5
Bin packing – First fit algorithm
2 1 4 A B C D E F The third block will not fit in the first bin 6 5 3 3 3 2
6
Bin packing – First fit algorithm
1 4 2 A B C D E F But there is room in the second bin 6 5 3 3 3 2
7
Bin packing – First fit algorithm
5 5 1 5 4 2 A B C D E F The third bin is the first one the 5 will fit in 6 3 3 3 2
8
Bin packing – First fit algorithm
3 1 3 5 4 2 A B C D E F The second bin has room for the 3 6 3 3 2
9
Bin packing – First fit algorithm
2 2 2 1 3 5 4 2 2 A B C D E F The fourth bin is the first one with room for the next one 6 3 3
10
Bin packing – First fit algorithm
3 3 3 1 3 5 3 4 2 2 A B C D E F The next one also fits in the fourth bin 6 3
11
Bin packing – First fit algorithm
6 6 6 6 6 1 3 5 3 4 2 2 A B C D E F No room until the fifth bin for the 6 3
12
Bin packing – First fit algorithm
3 3 3 3 3 6 1 3 5 3 4 3 2 2 A B C D E F The 3 has to start a new bin Total usage is 6 bins.
13
Bin packing – First fit decreasing algorithm
A B C D E F With the first fit decreasing algorithm we sort the blocks into descending order first. 6 5 4 3 3 3 2 2 1
14
Bin packing – First fit decreasing algorithm
A B C D E F 6 5 4 3 3 3 2 2 1
15
Bin packing – First fit decreasing algorithm
6 A B C D E F Now we use the first fit algorithm 5 4 3 3 3 2 2 1
16
Bin packing – First fit decreasing algorithm
5 6 5 A B C D E F 4 3 3 3 2 2 1
17
Bin packing – First fit decreasing algorithm
4 4 6 5 4 A B C D E F 3 3 3 2 2 1
18
Bin packing – First fit decreasing algorithm
3 3 3 6 5 4 3 A B C D E F 3 3 2 2 1
19
Bin packing – First fit decreasing algorithm
3 3 3 6 3 5 4 3 A B C D E F 3 2 2 1
20
Bin packing – First fit decreasing algorithm
3 3 3 3 6 3 5 4 3 3 A B C D E F 2 2 1
21
Bin packing – First fit decreasing algorithm
2 2 6 2 3 5 4 3 3 A B C D E F 2 1
22
Bin packing – First fit decreasing algorithm
2 2 2 2 6 2 3 5 2 4 3 3 A B C D E F 1
23
Bin packing – First fit decreasing algorithm
1 6 1 2 3 5 2 4 3 3 A B C D E F We have packed them into 5 bins.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.