SLIDE 1 Chapter 3: Planning and Scheduling Bin Packing
Problem Suppose you plan to build a wall system for your books, CDs, DVDs, and stereo set. It requires 24 wooden shelves
- f various lengths: 6, 6, 5, 5, 5, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 7,
7, 5, 5, 8, 8, 4, 4, and 5 feet. The lumberyard, however, sells wood only in boards of length 9 feet. If each board costs $8, what is the minimum cost to buy sufficient wood for the wall system? We could just buy 24 boards at $8 each but this would a huge waste of lumber.
SLIDE 2
Chapter 3: Planning and Scheduling Bin Packing
Bin Packing The problem of finding the minimum number of bins into which the weight can be packed. Find the minimum number of bins (containers) of capacity, W. Where weights w1, w2, …,wn are packed into the bins. Each weight of object is less than or equal to W (wi W). Instead of fixing the number of machines and finding a minimum completion time, we want to find the minimum number of machines (bins), each with a fixed capacity W .
SLIDE 3
Chapter 3: Planning and Scheduling Bin Packing
Heuristic Algorithms Methods that can be carried out quickly but cannot guarantee to produce optimal results. Once again, there is no fast or optimal algorithm, so we will look at several methods and compare them.
SLIDE 4
Chapter 3: Planning and Scheduling Bin Packing
Bin Packing — Six Methods 1. Next Fit (NF) 2. Next Fit Decreasing (NFD) 3. First Fit (FF) 4. First Fit Decreasing (FFD) 5. Worse Fit (WF) 6. Worse Fit Decreasing (WFD)
SLIDE 5
Next Fit (NF) – A new bin is opened if the weight to be packed next will not fit in the bin that is currently being filled; the current bin is then closed.
Chapter 3: Planning and Scheduling Bin Packing
SLIDE 6
Chapter 3: Planning and Scheduling Bin Packing
Next Fit (NF) Advantages – Does not require knowledge of all the weights in advance; only need to know the remaining space in the bin. Disadvantages – The bin packed early on may have had room for small items that come later in the list. Best method for assembly-line packing.
SLIDE 7
Example Using Next Fit Bin Packing Pack list 6, 6, 5, 5, 5, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 7 7, 5, 5, 8, 8, 4, 4, 5
SLIDE 8 Chapter 3: Planning and Scheduling Bin Packing
First Fit (FF) – The next weight to be packed is placed in the lowest-numbered bin already
- pened into which it will fit. If it does not fit in any
- pen bins, a new bin is opened.
Worse Fit (WF) – The next weight to be packed is placed into the open bin with the largest amount
- f room remaining. If it does not fit in any bins,
- pen a new bin.
SLIDE 9
Chapter 3: Planning and Scheduling Bin Packing
The first fit and the worst-fit would yield the same packing of bins.
SLIDE 10
Chapter 3: Planning and Scheduling Bin Packing
One problem with all three of these heuristics is that large weights that appear late in the list cannot be packed efficiently. Therefore, we should first sort the items to be packed in order of decreasing size, assuming that all items are known in advance.
SLIDE 11
Chapter 3: Planning and Scheduling Bin Packing
Decreasing-Time Heuristics (NFD, FFD, WFD) – Create the priority list by listing the tasks in order of decreasing size before the bin-packing method.
SLIDE 12
Chapter 3: Planning and Scheduling Bin Packing
Example Using Decreasing-Time Heuristics Pack list 8, 8, 7, 7, 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2
SLIDE 13 Chapter 3: Planning and Scheduling Bin Packing
A way to predict the least number of bins that must be used is to divide the total weight by the weight capacity of each bin. In the example this means find the total length
- f boards needed to make the 24 shelves and divide this
number by 9 since this is the length of one board at the lumberyard. So the minimum number of boards you have to buy is 13 boards.
110 2 12 9 9