Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe...

34
Math Models of OR: The Transportation Problem John E. Mitchell Department of Mathematical Sciences RPI, Troy, NY 12180 USA October 2018 Mitchell The Transportation Problem 1 / 20

Transcript of Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe...

Page 1: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Math Models of OR:The Transportation Problem

John E. Mitchell

Department of Mathematical SciencesRPI, Troy, NY 12180 USA

October 2018

Mitchell The Transportation Problem 1 / 20

Page 2: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

Outline

1 The Transportation Problem

2 The transportation tableau

3 Finding an initial basic feasible solution

Mitchell The Transportation Problem 2 / 20

Page 3: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

The transportation problem

Network flow problems are defined on graphs, with material flowingalong edges from node to node. A transportation problem is a networkflow problem with a special structure:

There is a collection of m sources, with source i having supply aiavailable.There is a collection of n destinations, with destination j havingdemand bj .The only edges connect a source directly to a destination.Each edge from source i to destination j has a per-unit shippingcost cij .The total supply is equal to the total demand:

∑mi=1 ai =

∑nj=1 bj .

(We will discuss relaxing this assumption later.)

Mitchell The Transportation Problem 3 / 20

Page 4: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

The transportation problem

Network flow problems are defined on graphs, with material flowingalong edges from node to node. A transportation problem is a networkflow problem with a special structure:

There is a collection of m sources, with source i having supply aiavailable.There is a collection of n destinations, with destination j havingdemand bj .The only edges connect a source directly to a destination.Each edge from source i to destination j has a per-unit shippingcost cij .The total supply is equal to the total demand:

∑mi=1 ai =

∑nj=1 bj .

(We will discuss relaxing this assumption later.)

Mitchell The Transportation Problem 3 / 20

Page 5: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

The transportation problem

Network flow problems are defined on graphs, with material flowingalong edges from node to node. A transportation problem is a networkflow problem with a special structure:

There is a collection of m sources, with source i having supply aiavailable.There is a collection of n destinations, with destination j havingdemand bj .The only edges connect a source directly to a destination.Each edge from source i to destination j has a per-unit shippingcost cij .The total supply is equal to the total demand:

∑mi=1 ai =

∑nj=1 bj .

(We will discuss relaxing this assumption later.)

Mitchell The Transportation Problem 3 / 20

Page 6: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

The transportation problem

Network flow problems are defined on graphs, with material flowingalong edges from node to node. A transportation problem is a networkflow problem with a special structure:

There is a collection of m sources, with source i having supply aiavailable.There is a collection of n destinations, with destination j havingdemand bj .The only edges connect a source directly to a destination.Each edge from source i to destination j has a per-unit shippingcost cij .The total supply is equal to the total demand:

∑mi=1 ai =

∑nj=1 bj .

(We will discuss relaxing this assumption later.)

Mitchell The Transportation Problem 3 / 20

Page 7: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

The transportation problem

Network flow problems are defined on graphs, with material flowingalong edges from node to node. A transportation problem is a networkflow problem with a special structure:

There is a collection of m sources, with source i having supply aiavailable.There is a collection of n destinations, with destination j havingdemand bj .The only edges connect a source directly to a destination.Each edge from source i to destination j has a per-unit shippingcost cij .The total supply is equal to the total demand:

∑mi=1 ai =

∑nj=1 bj .

(We will discuss relaxing this assumption later.)

Mitchell The Transportation Problem 3 / 20

Page 8: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

An example

s3

s2

s1

d3

d2

d1c11 = 2

c12 = 4

c13 = 3

c21 = 1

c22 = 5

c23 = 2

c31 = 1

c32 = 1

c33 = 620

20

20

20

30

10

supply sources destinations demand

Mitchell The Transportation Problem 4 / 20

Page 9: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

Linear optimization problem representation

A transportation problem can be written as a linear optimizationproblem:

minx∈IRm×n∑m

i=1∑n

j=1 cijxij

subject to∑n

j=1 xij = ai i = 1, . . . ,m (supply constraints)∑mi=1 xij = bj j = 1, . . . ,n (demand constraints)

xij ≥ 0 i = 1, . . . ,m, j = 1, . . . ,n

This is in standard form, so we could use the simplex algorithm tosolve it.

However, the problem can be large, with the number of variables equalto the product mn.

Mitchell The Transportation Problem 5 / 20

Page 10: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

Tableau for our example problem

x11 x12 x13 x21 x22 x23 x31 x32 x330 2 4 3 1 5 2 1 1 6

20 1 1 1 0 0 0 0 0 020 0 0 0 1 1 1 0 0 020 0 0 0 0 0 0 1 1 110 1 0 0 1 0 0 1 0 030 0 1 0 0 1 0 0 1 020 0 0 1 0 0 1 0 0 1

Notice that each row has exactly two “ones”, with all other entriesequal to zero. Notice also that the sum of the first three rows isidentical to the sum of the last three rows, so the constraints arelinearly dependent. This means one of the constraints could bediscarded: if we have the right amount of material leaving all thesources and the right amount going in to all but one of the destinations,then we must have the right amount entering the final destination.

Mitchell The Transportation Problem 6 / 20

Page 11: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The Transportation Problem

The constraints are linearly dependent

Algebraically, we can find a nontrivial linear combination of theconstraints that gives the trivial constraint 0 = 0, showing theconstraints are linearly dependent:

We have∑n

j=1 xij = ai for i = 1, . . . ,mand

∑mi=1 xij = bj for j = 1, . . . ,n

=⇒∑m

i=1

(∑nj=1 xij

)−∑n

j=1(∑m

i=1 xij)=∑m

i=1 ai −∑n

j=1 bj

=⇒ 0 = 0 by assumption that total supplyand total demand are equal

Mitchell The Transportation Problem 7 / 20

Page 12: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The transportation tableau

Outline

1 The Transportation Problem

2 The transportation tableau

3 Finding an initial basic feasible solution

Mitchell The Transportation Problem 8 / 20

Page 13: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The transportation tableau

Simplex, but written differently

Since a transportation problem is a linear optimization problem, we aregoing to solve it using the simplex algorithm.

It won’t look like the simplex algorithm.

We exploit the structure of the problem to use a more compact type oftableau, and to calculate the pivots more efficiently.

The basic feasible solutions have a special structure in the network.

Mitchell The Transportation Problem 9 / 20

Page 14: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The transportation tableau

Find a feasible solution

First, we exploit the structure of the problem to find a feasible solution.

We ship from the first source with available supply to the firstdestination that has unmet demand.

We update the available supply and unmet demand and repeat, untilall material has been shipped.

Mitchell The Transportation Problem 10 / 20

Page 15: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The transportation tableau

The feasible solution

s3

s2

s1

d3

d2

d1

20

20

20

20

30

10

s3

s2

s1

d3

d2

d1x11 = 10

20

20

10 20

20

30

10 0

s3

s2

s1

d3

d2

d1x11 = 10x12 = 10

20

20

0 10 20

20

30 20

10 0

Mitchell The Transportation Problem 11 / 20

Page 16: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The transportation tableau

Finding the feasible solution (continued)

s3

s2

s1

d3

d2

d1x11 = 10x12 = 10

20

20

0 10 20

20

30 20

10 0

s3

s2

s1

d3

d2

d1x11 = 10x12 = 10x22 = 20

20

0 20

0 10 20

20

30 20 0

10 0

s3

s2

s1

d3

d2

d1x11 = 10x12 = 10x22 = 20

x33 = 200 20

0 20

0 10 20

20 0

30 20 0

10 0

Mitchell The Transportation Problem 12 / 20

Page 17: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

The transportation tableau

Transportation tableauThe transportation tableau has one row for each source and onecolumn for each destination.

The cost cij is placed in cell (i , j); these entries are updated to thereduced costs as the algorithm proceeds.

The flows xij are stored as superscripts in the corresponding cells.

Thus, the solution we found can be stored in the followingtransportation tableau:

supply

demandb1 = 10 b2 = 30 b3 = 20

a1 = 20 210 410 3a2 = 20 1 520 2a3 = 20 1 1 620

Mitchell The Transportation Problem 13 / 20

Page 18: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Outline

1 The Transportation Problem

2 The transportation tableau

3 Finding an initial basic feasible solution

Mitchell The Transportation Problem 14 / 20

Page 19: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Basic feasible solutionsThe simplex algorithm works with basic feasible solutions. The solutionwe found earlier is a feasible solution, but is it a basic feasiblesolution? Not quite, but it can be modified easily to give a basicfeasible solution.

DefinitionA basic feasible solution for a transportation problem with m sourcesand n destinations satisfies the following properties:

it is feasible.it contains exactly m + n − 1 basic variables.the basic variables correspond to a spanning tree in the network;that is, for any two nodes u and v in the network, there is exactlyone path from u to v that traverses only the arcs corresponding tobasic variables, perhaps traversing some arcs in the reversedirection.

Mitchell The Transportation Problem 15 / 20

Page 20: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Basic feasible solutionsThe simplex algorithm works with basic feasible solutions. The solutionwe found earlier is a feasible solution, but is it a basic feasiblesolution? Not quite, but it can be modified easily to give a basicfeasible solution.

DefinitionA basic feasible solution for a transportation problem with m sourcesand n destinations satisfies the following properties:

it is feasible.it contains exactly m + n − 1 basic variables.the basic variables correspond to a spanning tree in the network;that is, for any two nodes u and v in the network, there is exactlyone path from u to v that traverses only the arcs corresponding tobasic variables, perhaps traversing some arcs in the reversedirection.

Mitchell The Transportation Problem 15 / 20

Page 21: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Basic feasible solutionsThe simplex algorithm works with basic feasible solutions. The solutionwe found earlier is a feasible solution, but is it a basic feasiblesolution? Not quite, but it can be modified easily to give a basicfeasible solution.

DefinitionA basic feasible solution for a transportation problem with m sourcesand n destinations satisfies the following properties:

it is feasible.it contains exactly m + n − 1 basic variables.the basic variables correspond to a spanning tree in the network;that is, for any two nodes u and v in the network, there is exactlyone path from u to v that traverses only the arcs corresponding tobasic variables, perhaps traversing some arcs in the reversedirection.

Mitchell The Transportation Problem 15 / 20

Page 22: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Basic feasible solutionsThe simplex algorithm works with basic feasible solutions. The solutionwe found earlier is a feasible solution, but is it a basic feasiblesolution? Not quite, but it can be modified easily to give a basicfeasible solution.

DefinitionA basic feasible solution for a transportation problem with m sourcesand n destinations satisfies the following properties:

it is feasible.it contains exactly m + n − 1 basic variables.the basic variables correspond to a spanning tree in the network;that is, for any two nodes u and v in the network, there is exactlyone path from u to v that traverses only the arcs corresponding tobasic variables, perhaps traversing some arcs in the reversedirection.

Mitchell The Transportation Problem 15 / 20

Page 23: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Getting a basic feasible solution

The feasible solution we found earlier has positive values of xij for 4edges.

s3

s2

s1

d3

d2

d1x11 = 10

x12 = 10

x22 = 20

x33 = 2020

20

20

20

30

10

We have m + n − 1 = 3 + 3− 1 = 5. So we don’t have a basic feasiblesolution.

Also, there is no path from s1 to d3 (for example) that only uses thearcs with positive xij .

Mitchell The Transportation Problem 16 / 20

Page 24: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

Adding degenerate basic variablesThis can be remedied by declaring x23 a basic variable, with flowx23 = 0.

s3

s2

s1

d3

d2

d1x11 = 10

x12 = 10

x22 = 20

x23 = 0

x33 = 2020

20

20

20

30

10

We now have a (unique) path from s1 to d3, namelys1 → d2 → s2 → d3.

Mitchell The Transportation Problem 17 / 20

Page 25: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The Northwest Corner Rule

Basic feasible solutions can be constructed directly using a slightmodification of the earlier approach. This is known as the NorthwestCorner Rule:

1 If there are fewer than m + n− 1 basic variables then pick the costentry in the upper left (northwest) corner of the tableau and shipas much as possible along that arc so that supply is used up ordemand is used up.

2 If the assignment just made uses up the demand for the columnthen eliminate that column from further consideration and return toStep 1.

3 If the assignment just made uses up the supply for the row theneliminate that row from further consideration and return to Step 1.

Mitchell The Transportation Problem 18 / 20

Page 26: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The Northwest Corner Rule

Basic feasible solutions can be constructed directly using a slightmodification of the earlier approach. This is known as the NorthwestCorner Rule:

1 If there are fewer than m + n− 1 basic variables then pick the costentry in the upper left (northwest) corner of the tableau and shipas much as possible along that arc so that supply is used up ordemand is used up.

2 If the assignment just made uses up the demand for the columnthen eliminate that column from further consideration and return toStep 1.

3 If the assignment just made uses up the supply for the row theneliminate that row from further consideration and return to Step 1.

Mitchell The Transportation Problem 18 / 20

Page 27: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The Northwest Corner Rule

Basic feasible solutions can be constructed directly using a slightmodification of the earlier approach. This is known as the NorthwestCorner Rule:

1 If there are fewer than m + n− 1 basic variables then pick the costentry in the upper left (northwest) corner of the tableau and shipas much as possible along that arc so that supply is used up ordemand is used up.

2 If the assignment just made uses up the demand for the columnthen eliminate that column from further consideration and return toStep 1.

3 If the assignment just made uses up the supply for the row theneliminate that row from further consideration and return to Step 1.

Mitchell The Transportation Problem 18 / 20

Page 28: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

If use up supply and meet demand simultaneously

Note that if an assignment uses up both the supply and the demandthen we only eliminate the column.

This means that on the next iteration the top-most source will haveavailable supply of zero, so the next arc added to the set of basicvariables will have xij = 0.

Mitchell The Transportation Problem 19 / 20

Page 29: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The NW corner rule for the example

10 30 2020 2 4 320 1 5 220 1 1 6

10 30 2020 210 4 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 520 220 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 620

Mitchell The Transportation Problem 20 / 20

Page 30: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The NW corner rule for the example

10 30 2020 2 4 320 1 5 220 1 1 6

10 30 2020 210 4 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 520 220 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 620

Mitchell The Transportation Problem 20 / 20

Page 31: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The NW corner rule for the example

10 30 2020 2 4 320 1 5 220 1 1 6

10 30 2020 210 4 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 520 220 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 620

Mitchell The Transportation Problem 20 / 20

Page 32: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The NW corner rule for the example

10 30 2020 2 4 320 1 5 220 1 1 6

10 30 2020 210 4 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 520 220 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 620

Mitchell The Transportation Problem 20 / 20

Page 33: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The NW corner rule for the example

10 30 2020 2 4 320 1 5 220 1 1 6

10 30 2020 210 4 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 520 220 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 620

Mitchell The Transportation Problem 20 / 20

Page 34: Math Models of OR: The Transportation Problemeaton.math.rpi.edu/.../15B_transportationbeamer.pdfThe Transportation Problem The transportation problem Network flow problems are defined

Finding an initial basic feasible solution

The NW corner rule for the example

10 30 2020 2 4 320 1 5 220 1 1 6

10 30 2020 210 4 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 5 220 1 1 6

10 30 2020 210 410 320 1 520 220 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 6

10 30 2020 210 410 320 1 520 20

20 1 1 620

Mitchell The Transportation Problem 20 / 20