The Transportation Algorithm
The Transportation Algorithm
Luis Goddyn
SFU Burnaby
The goal is to convert a feasible basic transportation tableau, such as is produced by VAM, into
an optimal basic transportation tableau. The transportation algorithm of the textbook is a
network simplex algorithm since it mimics Phase 2 of the simplex algorithm.
How can we tell if a transportation tableau is optimal?
M3
M1 M2 M3 25
W1
W1 30 20 15 10 25 40 15
W2 15 30 30 25 30 M2
15 15
M1
W3
W3 30 15 20 15 15 30 30
45 30 25 W2
The goal is to convert a feasible basic transportation tableau, such as is produced by VAM, into
an optimal basic transportation tableau. The transportation algorithm of the textbook is a
network simplex algorithm since it mimics Phase 2 of the simplex algorithm.
How can we tell if a transportation tableau is optimal?
M3
M1 M2 M3 25
15 25 W1
W1 30 20 10 40 15
W2 15 30 30 25 30 M2
15 15
M1
15 15 W3 30
W3 30 20 15 30
45 30 25 W2
The dual slack variables, sij , of the simplex tableau tell us that this one is optimal.
x11 x23 x22 x33 −1
M3
−1 1 1 1 15 = −x32
W1
0 1 1 0 30 = −x21
1 −1 −1 0 15 = −x31 $5 $0
M2 M1
1 −1 0 −1 15 = −x12 W3
$30
$25
0 1 0 1 25 = −x13
W2
0 −30 −25 −50 1750 = f
= s11 = s23 = s22 = s33
The goal is to convert a feasible basic transportation tableau, such as is produced by VAM, into
an optimal basic transportation tableau. The transportation algorithm of the textbook is a
network simplex algorithm since it mimics Phase 2 of the simplex algorithm.
How can we tell if a transportation tableau is optimal?
M3
M1 M2 M3 25
15 25 W1
W1 30 20 10 40 15
W2 15 30 30 25 30 M2
15 15
M1
15 15 W3 30
W3 30 20 15 30
45 30 25 W2
The dual slack variables, sij , of the simplex tableau tell us that this one is optimal.
x11 x23 x22 x33 −1
M3
−1 1 1 1 15 = −x32
W1
0 1 1 0 30 = −x21
1 −1 −1 0 15 = −x31 $5 $0
M2 M1
1 −1 0 −1 15 = −x12 W3
$30
$25
0 1 0 1 25 = −x13
W2
0 −30 −25 −50 1750 = f
= s11 = s23 = s22 = s33
We need to compute sij for every non-basic edge, and check whether sij ≥ 0.
M3
W1
$20 $30
M2 $30 M1
W3
$15
$25
W2
To compute s22 :
M3
W1
$20 $30
M2 $30 M1
W3
$15
$25
W2
To compute s22 :
Naive method: Find the cycle using edge (W2 , M2 ) and some tree edges. Then take an
alternating sum of their costs.
s22 = 30 − 20 + 30 − 15 = $25.
M3
W1
$20 $30
M2 $30 M1
W3
$15
$25
W2
To compute s22 :
Naive method: Find the cycle using edge (W2 , M2 ) and some tree edges. Then take an
alternating sum of their costs.
s22 = 30 − 20 + 30 − 15 = $25.
M3
0
$1
$25
W1
5
$1
$20 $30
$20 $5 $0 $30
M2 $30 M1
W3
$30 $15
$25
W2
To compute s22 :
Naive method: Find the cycle using edge (W2 , M2 ) and some tree edges. Then take an
alternating sum of their costs.
s22 = 30 − 20 + 30 − 15 = $25.
Repeat this for every nonbasic edge.
M3
0
$1
$25
W1
5
$1
$20 $30
$20 $30
M2 $30 M1
W3
$15
W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
M3
0
$1
$25
W1
5
$1
$20 $30 $0
$20 $30
M2 $30 M1
W3
$15
W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
M3
0
$1
$25
W1
5
$1
$20 $30 $0
$20 $30
M2 $30 M1
W3
$15
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
M3
0
$1
$25
W1
5
$1
$20 $30 $0
$20 $30
M2 $30 M1
$30 W 3
$15
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
M3
0
$1
$25
W1
5
$1
−$10 $20 $30 $0
$20 $30
M2 $30 M1
$30 W 3
$15
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
M3
0
$1
$25
W
$30 1
5
$1
−$10 $20 $30 $0
$20 $30
M2 $30 M1
$30 W 3
$15
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
$25
W
$30 1
5
$1
−$10 $20 $30 $0
$20 $30
M2 $30 M1
$30 W 3
$15
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
$25
W
$30 1
5
$1
−$10 $20 $30 $0
$20 $30
M2 $30 M1
$30 W 3
$15
$25
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
c) For every non basic edge (i, j), set
sij = cij − ai − bj .
$25
W
$30 1
5
$1
−$10 $20 $30 $0
$20 $5 $0 $30
M2 $30 M1
$30 W 3 $30 $15
$25
$15 W2
To compute s22 :
Better method: Compute node prices a1 , a2 , a3 , b1 , b3 , b3 for every node:
a) Pick any node, and give it any price. (The textbook suggests setting b1 = $0, but
often a higher price works better.)
b) Find all the other node prices iteratively by using tree edges and the equation
cij = ai + bj , for every basic edge (i, j).
c) For every non basic edge (i, j), set
sij = cij − ai − bj .
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 W1
5
$1
$20 $30 $0
30 20 10 $20 $30
M2 $30 M1
15 30 25 W3
$15
30 20 15
W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 W1
5
$1
$20 $30 $0
30 20 10 $20 $30
M2 $30 M1
15 15 30 25 W3
$15
30 20 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 W1
5
$1
$20 $30 $0
30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 W1
5
$1
−$10 $20 $30 $0
30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 30 0 0
M2 $30 M1
15 0 30 25 $30 W 3
30 0 0 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 30 0 0
M2 $30 M1
15 0 25 25 $30 W 3
$25
30 0 0 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 30 0 0
M2 $30 M1
15 0 25 30 $30 W 3 $30
$25
30 0 0 15
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 30 0 0 $5
M2 $30 M1
15 0 25 30 $30 W 3 $30
$25
30 0 0 5
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 0 0 0 $5 $0
M2 $30 M1
15 0 25 30 $30 W 3 $30
$25
30 0 0 5
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
−$20
Find node prices, using bj = 0 and cij = ai + bj : M3
0
$1
$25
0 -10 -20 W
$30 1
5
$1
−$10 $20 $30 $0
30 30 20 10 $20 $30
M2 $30 M1
15 15 30 25 $30 W 3
$15
30 30 20 15
$15 W2
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 0 0 0 $5 $0
M2 $30 M1
15 0 25 30 $30 W 3 $30
$25
30 0 0 5
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
The initial node and initial price is arbitrary, since cij − (ai − t) − (bj + t) = cij − ai − bj .
0 -10 -20 15
30 30 20 10 30 20 10
15 15 30 25 15 30 25
30 30 20 15 30 20 15
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 0 0 0 $5 $0
M2 $30 M1
15 0 25 30 $30 W 3 $30
$25
30 0 0 5
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
The initial node and initial price is arbitrary, since cij − (ai − t) − (bj + t) = cij − ai − bj .
0 -10 -20 15 5 −5
30 30 20 10 15 30 20 10
15 15 30 25 0 15 30 25
30 30 20 15 15 30 20 15
$25
W
0 -10 -20 $30 1
5
−$10 $1 $30 $0
30 0 0 0 $5 $0
M2 $30 M1
15 0 25 30 $30 W 3 $30
$25
30 0 0 5
$15 W2
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
The initial node and initial price is arbitrary, since cij − (ai − t) − (bj + t) = cij − ai − bj .
0 -10 -20 15 5 −5
30 30 20 10 15 30 20 10
15 15 30 25 0 15 30 25
30 30 20 15 15 30 20 15
0 -10 -20 15 5 -5
30 0 0 0 15 0 0 0
15 0 25 30 0 0 25 30
30 0 0 5 15 0 0 5
$25
M1 M2 M3 W1
5
$1
$20 $30
W1 30 20 15 10 25 40 $20 $30
M2 M1
W2 15 30 30 25 30 $30
W3
$15
W3 30 15 20 15 15 30
W2
45 30 25
The initial node and initial price is arbitrary, since cij − (ai − t) − (bj + t) = cij − ai − bj .
0 -10 -20 15 5 -5
30 0 0 0 15 0 0 0
15 0 25 30 0 0 25 30
30 0 0 5 15 0 0 5
m X
X n
(P) min C = cij xij
i=1 j=1
n
X
s. t. xij = si , (i = 1, 2, . . . , m)
j=1
m
X
xij = dj , (j = 1, 2, . . . , n)
i=1
xij > 0, for all i, j
m X
X n
(P) min C = cij xij
i=1 j=1
n
X
s. t. xij = si , (i = 1, 2, . . . , m) (ai )
j=1
m
X
xij = dj , (j = 1, 2, . . . , n) (bj )
i=1
xij > 0, for all i, j
X n
m X m
X n
X
(P) min C = cij xij (D) max P= si ai + dj bj
i=1 j=1 i=1 j=1
n
X s. t. ai + bj ≤ cij for all i, j (xij )
s. t. xij = si , (i = 1, 2, . . . , m) (ai )
ai , bj unrestricted
j=1
m
X
xij = dj , (j = 1, 2, . . . , n) (bj )
i=1
xij > 0, for all i, j
2 1 2 40
9 4 7 60
1 2 9 10
40 50 20 110
20 20
2 1 2 40 2 1 2 40
VAM
9 4 7 60 −−→ 9
10
4
50
7 60
10
1 2 9 10 1 2 9 10
40 50 20 110 40 50 20 110
0
20 20
2 1 2 40 2 1 2 40
VAM
9 4 7 60 −−→ 9
10
4
50
7 60
10
1 2 9 10 1 2 9 10
40 50 20 110 40 50 20 110
0
20 20
2 1 2 40 2 2 1 2 40
VAM
9 4 7 60 −−→ 9
10
4
50
7 60
10
1 2 9 10 1 2 9 10
40 50 20 110 40 50 20 110
0
20 20
2 1 2 40 2 2 1 2 40
VAM
9 4 7 60 −−→ 9 9
10
4
50
7 60
10
1 2 9 10 1 2 9 10
40 50 20 110 40 50 20 110
0
20 20
2 1 2 40 2 2 1 2 40
VAM
9 4 7 60 −−→ 9 9
10
4
50
7 60
10
1 2 9 10 1 1 2 9 10
40 50 20 110 40 50 20 110
0 −5
20 20
2 1 2 40 2 2 1 2 40
VAM
9 4 7 60 −−→ 9 9
10
4
50
7 60
10
1 2 9 10 1 1 2 9 10
40 50 20 110 40 50 20 110
0 −5 0
20 20
2 1 2 40 2 2 1 2 40
VAM
9 4 7 60 −−→ 9 9
10
4
50
7 60
10
1 2 9 10 1 1 2 9 10
40 50 20 110 40 50 20 110
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9
10 10
1 2 9 10 1 1 2 9 10 1
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0
10 10
1 2 9 10 1 1 2 9 10 1 0
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0
10 10
1 2 9 10 1 1 2 9 10 1 0
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
10
1 0 6 8 1
10
2 9
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
10
1 0 6 8 1 1
10
2 9
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
10
1 0 6 8 1 1
10
2 9
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
10
1 0 6 8 1 1
10
2 9
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
10
1 0 6 8 1 1
10
2 9
0 −5 0 0 −5 0
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
20+10 20−10 30 10 30 10
2 0 4 0 2 2 1 2 2 0 2 0
→ 9 50 10
-2 +10 → 7 → 7
10−10 50 50 10 2 0 0
0 0 9 4 7
10 10
1 0 6 8 1 1
10
2 9 1 0 4 8
20 20 20 20
2 1 2 40 2 2 1 2 40 2 0 4 0
VAM 10 50
9 4 7 60 −−→ 9 9
10
4
50
7 60 → 9 0 0 −2
10 10
1 2 9 10 1 1 2 9 10 1 0 6 8
20+10 20−10 30 10 30 10
2 0 4 0 2 2 1 2 2 0 2 0
→ 9 50 10
-2 +10 → 7 → 7
10−10 50 50 10 2 0 0
0 0 9 4 7
10 10
1 0 6 8 1 1
10
2 9 1 0 4 8
Optimal Solution
f ac ult y o f sc i en ce MATH 895-4 Fall 2010
d ep ar t m e n t o f m a t hem a t ics Course Schedule 8 / 17
Solve the following BTP
5 12 8 50 26
11 4 10 8 20
14 50 1 9 30
15 20 26 15
15 20 26 15
11 4 10 8 20
14 50 1 9 30
15 20 26 15
Maximization
Forbidden routes
Unbalanced Transportation
Maximization
Forbidden routes
Unbalanced Transportation
Maximization
Convert to a minimization problem by replacing each cost cij0 = −cij .
Forbidden routes
Unbalanced Transportation
Maximization
Convert to a minimization problem by replacing each cost cij0 = −cij .
Forbidden routes
If the route from Wi to Mj is forbidden, then give that edge a prohibitively high cost cij = ∞ .
Unbalanced Transportation
Maximization
Convert to a minimization problem by replacing each cost cij0 = −cij .
Forbidden routes
If the route from Wi to Mj is forbidden, then give that edge a prohibitively high cost cij = ∞ .
Unbalanced Transportation X X
Case I: If total demand exceeds total supply, si > dj , then add a “dummy”
1≤i≤m 1≤j≤n
warehouse Wm+1 with supply X X
sm+1 = dj − si .
1≤j≤n 1≤i≤m
Assign cost zero to each new edge, cm+1,j = 0 for j = 1, 2, . . . , n. The new problem is balanced.
Maximization
Convert to a minimization problem by replacing each cost cij0 = −cij .
Forbidden routes
If the route from Wi to Mj is forbidden, then give that edge a prohibitively high cost cij = ∞ .
Unbalanced Transportation X X
Case II: If total supply exceeds total demand, si > dj , then add a “dummy”
1≤i≤m 1≤j≤n
market Mn+1 with demand X X
dn+1 = si − dj .
1≤i≤m 1≤j≤n
Assign cost zero to each new edge, ci,n+1 = 0 for i = 1, 2, . . . , m. The new problem is balanced.
m
X n
X
si < dj
i=1 j=1
Solution: We introduce a fictitious warehouse Wm+1 which supplies the excess demand.
• Set cm+1,j = 0 for all j = 1, 2, . . . , n.
• In reality we may use different costs—loss in sale, alternative supply, . . .
• Interpretation—demand of some markets is not fully satisfied.
2 1 2 40
9 4 7 60
1 2 9 10
50 60 30
m
X n
X
si > dj
i=1 j=1
Solution: We introduce a fictitious market Mn+1 which demands the excess supply.
• Set ci,n+1 = 0 for all i = 1, 2, . . . , m.
• In reality we may use different costs—spoilage costs, storage costs, . . .
2 1 2 50
9 4 7 70
1 2 9 20
40 50 20
Wi Mj
Wi Mj
Wi Mj
Supply Demand
30
W 42
2
17
23 20 0 M
M 2
1
15
40 20
0 0 2
11 23
31 W1
15
10 35
Flow
0 37
5
W
15 3
M 42
3 7
Cost ( = distance )
11 23
31 W1
15
10 35
Flow
0 37
5
W
15 3
M 42
3 7
Cost ( = distance )
37
5
W
15 3
M 42
3 7
37
W
3
M 42
3
11 23
31 W1
35
37
W
3
M 42
3
11 23
31 W1
35
37
W
3
M 42
3
11 23
31 W1
35
37
W
3
M 42
3
11 23
31 W1
35
37
W
3
M 42
3
23
sij , xij , ai , bj
S11< 0 11
S 31
31 W1
5 15 22
S13 35
8 -2 0 15 1
37
18 0 20 9 0 10
W
3
M
3
42
20 12 0 2 0 5
23
sij , xij , ai , bj
S11< 0 11
S 31
31 W1
5 15 22
S13 35
8 -2 + 0 15 1
37
18 0 20 9 0 10
W
3
M
3
42
20 12 0 2 0 5
2
sij , xij , ai , bj
W1
5 15 22
15
10 8 -2 + 0 15 1
18 0 20 9 0 10
5
W
3
M
3 20 12 0 2 0 5
Find the cycle using the tree and “getter” (1, 1).
.
2
sij , xij , ai , bj
W1
5 15 22
15
10 8 -2 + 0 15 1
18 0 20 9 0 10
5
W
3
M
3 20 12 0 2 0 5
Primal Adjustment:
.
We will augment flow along the cycle.
2
sij , xij , ai , bj
W1
5 15 22
15
10 8 -2 + 0 15− 1
18 0 20− 9 0 10+
5
W
3
M
3 20 12 0 2+ 0 5−
Primal Adjustment:
.
We will augment flow along the cycle.
Mark with +/− the effect of flow augmentation.
2
sij , xij , ai , bj
W1
5 15 22
15
10 8 -2 + 0 15− 1
18 0 20− 9 0 10+
5
W
3
M
3 20 12 0 2+ 0 5−
Primal Adjustment:
.
We will augment flow along the cycle.
Mark with +/− the effect of flow augmentation.
Augment value: min{20, 5, 15} = 5.
7
5
sij , xij , ai , bj
W1
5 15 22
15 8 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
0
W
3
M
3 20 12 0 2+5 0 5−5
Primal Adjustment:
.
We will augment flow along the cycle.
Mark with +/− the effect of flow augmentation.
Augment value: min{20, 5, 15} = 5.
Adjust flows along cycle xij 7→ xij ± 5.
7
5
sij , xij , ai , bj
W1
5 15 22
15 8 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
W
3
M
3 20 12 0 2+5 0
Primal Adjustment:
.
We will augment flow along the cycle.
Mark with +/− the effect of flow augmentation.
Augment value: min{20, 5, 15} = 5.
Adjust flows along cycle xij 7→ xij ± 5.
Primal update is complete.
Edge (3, 3) can leave the tree.
sij , xij , ai , bj
S11< 0
W1
5 15 22
8 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
W
3
M
3 20 12 0 2+5 0
Dual update:
.
Node price adjustments are needed before (1, 1)
can enter the tree.
sij , xij , ai , bj
W1
5 15 22
8 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
W
3
M
3 20 12 0 2+5 0
Dual update:
.
Node price adjustments are needed before (1, 1)
can enter the tree.
Shrink/grow all disks on one side of the cut:
sij , xij , ai , bj
W1
5 15 22
8-2 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
W
3
M
3 20 12 0 2+5 0
Dual update:
.
Node price adjustments are needed before (1, 1)
can enter the tree.
Shrink/grow all disks on one side of the cut:
Decrease node price a1 to make (1, 1) tangent.
sij , xij , ai , bj
W1
5 15+2 22
8-2 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
W
3
M
3 20 12 0 2+5 0
Dual update:
.
Node price adjustments are needed before (1, 1)
can enter the tree.
Shrink/grow all disks on one side of the cut:
Decrease node price a1 to make (1, 1) tangent.
Increase b2 .
sij , xij , ai , bj
W1
5 15+2 22
8-2 -2 +5 0 15−5 1
18 0 20−5 9 0 10+5
W
3
M
3 20-2 12 0 2+5 0
Dual update:
.
Node price adjustments are needed before (1, 1)
can enter the tree.
Shrink/grow all disks on one side of the cut:
Decrease node price a1 to make (1, 1) tangent.
Increase b2 .
Decrease a3 .
sij , xij , ai , bj
W1
5 17 22
6 -2+2 5 0 10 1+2
18 0 15 9-2 0 15
W
3
M
3 18 12+2 0 7 0+2
Dual update:
.
Node price adjustments are needed before (1, 1)
can enter the tree.
Shrink/grow all disks on one side of the cut:
Decrease node price a1 to make (1, 1) tangent.
Increase b2 .
Decrease a3 .
Adjust reduced costs sij .
sij , xij , ai , bj
W1
5 17 22
6 0 5 0 10 3
18 0 15 7 0 15
W
3
M
3 18 14 0 7 2
Dual update:
Node price adjustments are needed before (1, 1)
.
can enter the tree.
Shrink/grow all disks on one side of the cut:
Decrease node price a1 to make (1, 1) tangent.
Increase b2 .
Decrease a3 .
Adjust reduced costs sij .
Dual update is complete.
f ac ult y o f sc i en ce MATH 895-4 Fall 2010 Edge (1, 1) enters the tree. 17 / 17
d ep ar t m e n t o f m a t hem a t ics Course Schedule
Transportation Algorithm - Geometric distances
cij , xij , ai , bj
5 15+2 22
8-2 11 5 23 10 31
18 23 15 42 40 15
W
2 7 20-2 37 35 7 42
15 M
M 2
1
10
7
5
sij , xij , ai , bj
14
W1
5 17 22
3
5 6 0 5 0 10 3
18 0 15 7 0 15
2
W
3
M
3 18 14 0 7 2
Next iteration:
Every sij is non-negative.
.
Solution is optimal.
Output (xij ), (ai ), (bj ) and STOP.