0304 Bin Packing

1 / 10

# 0304 Bin Packing - PowerPoint PPT Presentation

0304 Bin Packing. Background: Suppose you plan to build a wall system for your books, records, and stereo set in your dorm room. The wall system requires 24 wooden shelves of various lengths: 6,6,5,5,5,4,4,4,4,2,2,2,2,3,3,7,7,5,5,8,8,4 and 5 feet

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' 0304 Bin Packing' - chico

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Background:

Suppose you plan to build a wall system for your books, records, and stereo set in your dorm room. The wall system requires 24 wooden shelves of various lengths:

6,6,5,5,5,4,4,4,4,2,2,2,2,3,3,7,7,5,5,8,8,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 by sufficient wood for this wall system?

Bin-packing problem: when we wish to find the minimum number of “bins” into which the weights of a problem can be “packed” or sorted

There are 2 sets of 3 types of these problems that we will be talking about:

Next-fit (NF), first-fit (FF), worst-fit (WF)

Next-fit decreasing (NFD), first-fit decreasing (FFD), worst-fit decreasing (WFD)

Next Fit

Advantage – does not require knowing all the weights in advance & only the remaining space in the bin currently being packed must be remembered

Disadvantage – a bin packed early on may have had room for small items that come later in the list

How to: Put the weights into the first bin until the next weight won’t fit, and then start a new bin

Next Fit Example:

Weights: 6,6,5,5,5,4,4,4,4,2,2,2,2,3,3,7,7,5,5,8,8,4,4,5

Each bin is 9 feet long

4

2

3

4

4

2

7

7

2

8

8

6

6

5

5

5

5

5

5

4

4

4

3

2

First Fit

How to: Put the next weight into the first bin already opened that has room for this weight; if no such bin exists, start a new bin.

First Fit Example:

Weights: 6,6,5,5,5,4,4,4,4,2,2,2,2,3,3,7,7,5,5,8,8,4,4,5

Each bin is 9 feet long

4

4

4

4

2

2

4

2

2

3

7

7

8

8

6

6

5

5

5

5

5

5

4

3

Worst Fit

How to: Each item is packed into the bin with the most space, if the item doesn’t fit into any bins add another

Example:

Weights:

6,6,5,5,5,4,4,4,4,2,2,2,2,3,3,7,7,5,5,8,8,4,4,5

Each bin is 9 feet long

You try…

BUT these methods don’t account for large weights, that are more difficult to fit/pack, later in the list. Therefore, we should first sort the items to be packed in order of decreasing size. (That is, assuming we know these in advance.)

This approach yields three new methods:

Next-fit decreasing, First-fit decreasing, & Worst-fit decreasing

Note: NONE of the six heuristic methods will necessarily find the optimal number of bins for an arbitrary problem.

Homework- Pg 112: 40, 41, 42, 44

#44: “Best fit” is the opposite of the worst-fit method, where each item is packed into the bin that would leave the LEAST amount of available space in the bin