You are on page 1of 23

An application of Linear Programming to

the Transportation Problem


Problem formulation (I)

Problem: we want to minimize the cost of transferring a product from n


suppliers to m customers.

Hypotheses:
• the ith supplier has an allocated capacity Mi (i = 1, . . . n)
• the jth customer has a given demand Dj (j = 1, . . . m)
• the unit cost of transporting the product along the arc (i, j) is Ci,j .
Problem formulation (II)
Problem formulation as LP problem (I)

Choice of the decision variables:


• amount of product to be transported along each link:
x1,1 , x1,2 , x1,3 , x1,4 , x2,1 , x2,2 , x2,3 , x2,4 , x3,1 , x3,2 , x3,3 , x3,4
Problem formulation as LP problem (II)

Description of the constraints:


• amount of product to be transported along each link must be
non-negative:
• x1,1 ≥0
• x1,2 ≥0
• x1,3 ≥0
• x1,4 ≥0
• x2,1 ≥0
• x2,2 ≥0
• x2,3 ≥0
• x2,4 ≥0
• x3,1 ≥0
• x3,2 ≥0
• x3,3 ≥0
• x3,4 ≥0
Problem formulation as LP problem (III)

Description of the constraints:


• the total amount of product leaving a supplier may not exceed its
capacity:
• x1,1 + x1,2 + x1,3 + x1,4 ≤ M1
• x2,1 + x2,2 + x2,3 + x2,4 ≤ M2
• x3,1 + x3,2 + x3,3 + x3,4 ≤ M3
• the total amount of product reaching a customer must be equal to
its demand:
• x1,1 + x2,1 + x3,1 = D1
• x1,2 + x2,2 + x3,2 = D2
• x1,3 + x2,3 + x3,3 = D3
• x1,4 + x2,4 + x3,4 = D4
Problem formulation as LP problem (IV)

Description of the objective function:


• we want to minimise the overall cost of transport
• objective function:
3 X
X 4
z= Ci,j xi,j
i=1 j=1
Problem formulation as LP problem (V)

3 X
X 4
min z= Ci,j xi,j
i=1 j=1
s.t. x1,1 + x1,2 + x1,3 + x1,4 ≤ M1 ,
x2,1 + x2,2 + x2,3 + x2,4 ≤ M2 ,
x3,1 + x3,2 + x3,3 + x3,4 ≤ M3 ,
x1,1 + x2,1 + x3,1 = D1 ,
x1,2 + x2,2 + x3,2 = D2 ,
x1,3 + x2,3 + x3,3 = D3 ,
x1,4 + x2,4 + x3,4 = D4 ,
xi,j ≥ 0, i = 1, 2, 3; j = 1, 2, 3, 4.
Problem data

We set:
• M1 = 40, M2 = 50, M3 = 35;
• D1 = 30, D2 = 45, D3 = 25, D4 = 10;
• C1,1 = 6, C1,2 = 2, C1,3 = 6, C1,4 = 4;
• C2,1 = 9, C2,2 = 5, C2,3 = 5, C2,4 = 2;
• C3,1 = 1, C3,2 = 4, C3,3 = 6, C3,4 = 9.
Solution via LINGO (I)
Solution via LINGO (II)
Solution via LINGO (III)
Solution via LINGO (IV)
Solution via LINGO (V)
Formulation of the problem in standard form (I)

• We introduce a slack variable si for every supplier.

• We introduce an auxiliary variable yj for every customer.

• The slack variables si and the auxiliary variables yj sono ≥ 0.


P4
• We modify the objective function, adding the term M j=1 yj , with
M sufficiently large (big M method).
Formulation of the problem in standard form (II)

3 X
X 4 4
X
min z= Ci,j xi,j + M yj
i=1 j=1 j=1
s.t. x1,1 + x1,2 + x1,3 + x1,4 + s1 = M1 ,
x2,1 + x2,2 + x2,3 + x2,4 + s2 = M2 ,
x3,1 + x3,2 + x3,3 + x3,4 + s3 = M3 ,
x1,1 + x2,1 + x3,1 + y1 = D1 ,
x1,2 + x2,2 + x3,2 + y2 = D2 ,
x1,3 + x2,3 + x3,3 + y1 = D3 ,
x1,4 + x2,4 + x3,4 + y4 = D4 ,
xi,j ≥ 0, i = 1, 2, 3; j = 1, 2, 3, 4,
si ≥ 0, i = 1, 2, 3; yj ≥ 0, j = 1, 2, 3, 4 .
Formulation of the problem in standard form (III)

• Problem of the form

min z = cT t
s.t. At = b,
t ≥ 0,
A, b, c given, b ≥ 0.

• Starting with the basic feasible solution correspoding to the basic


variables: s1 , s2 , s3 , y1 , y2 , y3 , y4 .
• We can solve it with the simplex method, maximizing the −z target
instead of minimizing the z target. The simplex method can be
applied, for example, using the MATLAB “linprog” function..
Problem data (I)

• Vector of the decision variables:



t = x1,1 , x1,2 , x1,3 , x1,4 , x2,1 , x2,2 , x2,3 , x2,4 , x3,1 , x3,2 , x3,3 , x3,4 ,
T
s1 , s2 , s3 , y1 , y2 , y3 , y4

• vector of the constant terms:

b = (40, 50, 35, 30, 45, 25, 10)T

• Vector of the coefficients of the objective function:

c = (6, 2, 6, 4, 9, 5, 5, 2, 1, 4, 6, 9,
0, 0, 0, M, M, M, M)T
Problem data (II)

• Matrix A of the constraints

1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0
1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0
0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0
0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1

• The square sub-matrix corresponding to the blue colored elements is


an identity matrix, which identifies an eligible initial basic solution.
Solution with the big M method (I)

Initial Tableau (not in standard form), M = 100


x1,1 x1,2 x1,3 x1,4 x2,1 x2,2 x2,3 x2,4 x3,1 x3,2 x3,3 x3,4 s1 s2 s3 y1 y2 y3 y4 sol. corrente
−z 6 2 6 4 9 5 5 2 1 4 6 9 0 0 0 100 100 100 100 0
s1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 40
s2 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 50
s3 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 35
y1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 30
y2 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 45
y3 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 25
y4 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 10
Solution with the big M method (II)

Initial Tableau, M = 100


x1,1 x1,2 x1,3 x1,4 x2,1 x2,2 x2,3 x2,4 x3,1 x3,2 x3,3 x3,4 s1 s2 s3 y1 y2 y3 y4 sol. corrente
−z -94 -98 -94 -96 -91 -95 -95 -98 -99 -96 -94 -91 0 0 0 0 0 0 0 -11000
s1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 40
s2 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 50
s3 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 35
y1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 30
y2 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 45
y3 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 25
y4 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 10
Solution with the big M method (III)

Final Tableau, M = 100


x1,1 x1,2 x1,3 x1,4 x2,1 x2,2 x2,3 x2,4 x3,1 x3,2 x3,3 x3,4 s1 s2 s3 y1 y2 y3 y4 sol. corrente
−z 7 0 4 5 7 0 0 0 0 0 2 8 3 0 1 98 95 95 98 -275
x1,2 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 40
s2 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 -1 -1 -1 -1 15
x3,2 -1 0 0 0 -1 0 0 0 0 1 1 1 0 0 1 -1 0 0 0 5
x3,1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 30
x2,2 0 0 -1 -1 1 1 0 0 0 0 0 -1 -1 0 0 -1 1 0 0 0
x2,3 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 25
x2,4 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 10
Solution with the big M method (IV)

• After 6 iterations of the simplex method (with M = 100) you will


find with MATLAB the optimal basic solution


t̄ = 0, 40, 0, 0, 0, 0, 25, 10, 30, 5, 0, 0,
T
0, 15, 0, 0, 0, 0, 0

• Auxiliary variables in t̄∗ are outside the base, so they do not affect
the objective fucntion at the optimum. In addition, a base variable is
0 (basic degenerate solution).
• The optimum value of the objective function (once the original sign
has been restored) corresponds to that found with LINGO.

You might also like