Decision Maths - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Decision Maths

Description:

The Bin-packing problem deals with packing boxes of the same width and depth but ... A small car-ferry has three lanes, each 20m long. ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 15
Provided by: bengr1
Category:
Tags: decision | maths

less

Transcript and Presenter's Notes

Title: Decision Maths


1
Decision Maths
  • Lesson 12 Heuristic Algorithms

2
The Bin-packing problem
  • The Bin-packing problem deals with packing boxes
    of the same width and depth but different heights
    into bins.
  • Clearly you can see that the depth and width of
    the bins remains the same so we can represent the
    problem in 2-dimensions.

3
The Bin-packing problem
  • Its best to look at an example to understand how
    the Bin-packing problem works.
  • Here are 10 boxes, A to J with heights
  • (in dm) as follows.
  • How would you pack the boxes into bins that are
    15dm high.

4
The Bin-packing problem
  • First-fit algorithm
  • The idea is that you place the first box in the
    first available space, working from the left
    every time.
  • Here box A goes in to bin 1.
  • Now box B and C will also fit in to bin 1.
  • Box D does not fit in bin 1 so it goes in the
    next space which is bin 2.
  • Box E will not go in bin 1 or 2 so it is placed
    in bin 3.
  • Similar with F, it skips over Bins 1, 2 and 3 to
    go in bin 4.
  • G cannot go in bin 1 but it does slot into bin 2.
  • H will skip 1 and 2 and fill up bin 3.
  • I skips 1, 2 and 3 to fill up 4.
  • J must be placed in a new bin.

15
I(6)
H(8)
C(4)
G(3)
B(7)
D(9)
F(9)
E(7)
J(4)
A(3)
Bin 1
Bin 2
Bin 3
Bin 4
Bin 5
5
The Bin-packing problem
  • First-fit decreasing algorithm.
  • This is exactly the same method as the first-fit
    algorithm with one exception.
  • The difference this time is that the boxes are
    placed in descending order of size before the
    algorithm is applied.
  • You should use one of the sorting algorithms from
    last lesson to do this.
  • Now we can apply the algorithm
  • This algorithm is not guaranteed to give you the
    best (or optimal) solution.
  • However it is more likely to do so than just the
    First-fit algorithm.

15
B(7)
I(6)
A(3)
C(4)
J(4)
D(9)
F(9)
H(8)
E(7)
G(3)
Bin 1
Bin 2
Bin 3
Bin 4
Bin 5
6
The Bin-packing problem
  • Full bin combinations.
  • This is not an algorithmic process but more
    common sense.
  • You literally make sure that each bin is used to
    its full potential.
  • If you start by placing box D in bin 1 (No
    particular reason).
  • Now box I can also go in bin 1 and it will fill
    all the space because 9 6 15.
  • What other combinations will create full bins?
  • This is actually the optimal solution for this
    particular problem.

15
B(7)
I(6)
J(4)
G(3)
A(3)
C(4)
D(9)
F(9)
H(8)
E(7)
Bin 1
Bin 2
Bin 3
Bin 4
Bin 5
7
The Ferry Loading problem
  • This bin-packing problem can now be applied to
    lots of practical real life situations.
  • You can change what the boxes and bins represent.
  • We are going to look at how to load vehicles on
    to a ferry.
  • Here the lanes on the ferry will be the bins and
    the vehicles will be the boxes.

8
The Ferry Loading problem
  • A small car-ferry has three lanes, each 20m long.
  • The following vehicles are waiting to be loaded.
  • Oil tanker 13m Van 3m
  • Truck 7m Truck 6m
  • Coach 12m Car 4m
  • Car 4m Lorry 11m
  • Use the first-fit decreasing algorithm to load
    all these vehicles on to the trip.
  • Can all the vehicles be taken on the trip?

9
The Ferry Loading problem
  • First we need to sort the numbers.
  • Insertion sort algorithm

10
The Ferry Loading problem
  • Full Bin combinations
  • Solution
  • First-fit decreasing

C(7)
C(7)
G(4)
B(3)
G(4)
D(6)
D(6)
F(4)
F(4)
A(13)
A(13)
E(12)
E(12)
H(11)
H(11)
B(3)
Lane 1
Lane 2
lane 3
Lane 1
Lane 2
lane 3
11
The Disc storage problem
  • A software company has a new program that they
    want to sell on CDs.
  • Broken down the program looks like this.
  • Each of the CDs they will use can hold 700mb.
  • How many CDs will the company need if they plan
    on producing 50 000 copies of the program.

12
The Disc storage problem
  • Solution
  • This can be solved using full bin combinations or
    by the first-fit decreasing algorithm.
  • Here the solution is done using the first fit
    decreasing algorithm.
  • The program will fit exactly on to 4 CDs.
  • The company will need
  • 4 x 50 000 200 000 CDs.

D (250)
L
G
K
I
A (600)
F (250)
J
C (450)
H (200)
E (300)
B (200)
Disc 1
Disc 2
Disc 3
Disc 4
13
The Plumbing Problem
  • A plumber is using lengths of pipes 12 feet long
    and wishes to cut these lengths.
  • What is the best way of achieving this so that he
    wastes as little pipe as possible.

14
The Plumbing Problem
  • First change the table to assign each length of
    pipe a name.
  • Now you can apply the first-fit decreasing
    algorithm.
  • You can now easily see the full bin combinations.

J(3)
K(2)
J(3)
F(4)
K(2)
L(2)
E(4)
D(4)
F(4)
H(3)
I(3)
I(3)
G(3)
E(4)
A(7)
B(7)
A(7)
B(7)
H(3)
C(6)
C(6)
D(4)
G(3)
L(2)
Write a Comment
User Comments (0)
About PowerShow.com