transportation and assignment problemsise.tamu.edu/inen420/inen420_2005spring/slides/chapter...
TRANSCRIPT
1
L. Ntaimo (c) 2005 INEN420 TAMU
Transportation and Assignment Problems
Based onChapter 7
Introduction to Mathematical Programming: Operations Research, Volume 14th edition, by Wayne L. Winston and Munirpallam Venkataramanan
Lewis Ntaimo
2
L. Ntaimo (c) 2005 INEN420 TAMU
7.1Transportation Problems
1. Example formulation2. General formulation3. Balancing a transportation problem4. Finding a basic feasible solution5. The transportation simplex algorithm
3
L. Ntaimo (c) 2005 INEN420 TAMU
7.1 Powerco Problem
Powerco has 3 electric power plants that supply the needs of 4 cities. Each power plant can supply the following numbers of kilowatt-hours (kwh) of electricity: plant 1 – 35 million; plant 2 – 50 million; plant 3 – 40 million (see Table 1). The peak power demands in these cities, which occur at the same time (2pm), are as follows (in kwh): city 1 – 45 million; city 2 – 20 million; city 3 – 30 million; city 4 - 30 million. The costs of sending 1 million kwh of electricity from plant to city depend on the distance the electricity must travel. Formulate an LP to minimize the cost of meeting each city’s peak power demand.
Table 1: Shipping Costs, Supply, and Demand for Powerco
To Supply
From City 1 City 2 City 3 City 4 (million kwh)
Plant 1 $8 $6 $10 $9 $35
Plant 2 $9 $12 $13 $7 $50
Plant 3 $14 $9 $16 $5 $40
Demand 45 20 30 30
(million kwh)
4
L. Ntaimo (c) 2005 INEN420 TAMU
7.1 Graphical Representation
Demand Points
Plant 1
Plant 3
City 1
City 2
City 3
City 4
Supply Pointsd1 = 45
Plant 2
xij
s1 = 35 d2 = 20
s2 = 50d3 = 30
s3 = 40
d4 = 30
Decision Variables: xij # of (million) kwh produced at plant i and sent to city j
Constraints: Supply (Capacity) constraints
Demand constraints
5
L. Ntaimo (c) 2005 INEN420 TAMU
7.1 Powerco Problem Formulation
)4,3,2,1;3,2,1( 0 30 30 20 45
40 50 35 s.t.
516914 713129 9106 8Min
342414
332313
322212
132111
34333231
24232221
14131211
34333231
24232221
14131211
==≥≥++≥++≥++≥++
≤+++≤+++≤+++
+++++++++++
jixxxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
ij
Supply Constraints
Demand Constraints
Minimize total shipping costs
0. toequal ablesother vari ,30,10,5,45,10,10,1020
:solution Optimal
343223211312
allxxxxxxz =======
6
L. Ntaimo (c) 2005 INEN420 TAMU
7.1 Graphical Representation
Demand Points
Plant 1
Plant 3
City 1
City 2
City 3
City 4
Supply Pointsd1 = 45
Plant 2
x21= 45
x12= 10
x34= 30
x13= 25
x23= 5
x32= 10
s1 = 35 d2 = 20
s2 = 50d3 = 30
s3 = 40
d4 = 30
7
L. Ntaimo (c) 2005 INEN420 TAMU
7.1 General Formulation of a Transportation Problem
),...,2,1;,...,2,1( 0
s)constraint (demand ),...,2,1(
s)constraint(supply ),...,2,1( t.s.
Min
1
1
1 1
njmix
njdx
misx
xc
ij
j
n
iij
i
n
jij
m
i
n
jijij
==≥
=≥
=≤
∑
∑
∑∑
=
=
= =
8
L. Ntaimo (c) 2005 INEN420 TAMU
7.2 A Balanced Transportation Problem
∑∑==
=n
jj
m
ii ds
11
In a “balanced transportation” problem, the total supply is equal to the total demand:
• All constraints must be binding
• It becomes relatively easy to find a basic feasible solution
• Simplex pivots do not involve multiplication, they reduce to additions and subtractions
•Therefore, it is desirable to formulate a transportation problem as a balanced transportation problem
9
L. Ntaimo (c) 2005 INEN420 TAMU
7.2 A Balanced Transportation Problem
),...,2,1;,...,2,1( 0
s)constraint (demand ),...,2,1(
s)constraint(supply ),...,2,1( t.s.
Min
1
1
1 1
njmix
njdx
misx
xc
ij
j
n
iij
i
n
jij
m
i
n
jijij
==≥
==
==
∑
∑
∑∑
=
=
= =
10
L. Ntaimo (c) 2005 INEN420 TAMU
7.2 Balancing a Transportation Problem if Total Supply Exceeds Total Demand
Create a “dummy demand point” that has demand equal to the amount of excess supply
Shipments to the dummy demand point:
(1) Are assigned a cost of zero because they are not real shipments
(2) Indicate unused supply capacity
11
L. Ntaimo (c) 2005 INEN420 TAMU
Demand Points
7.2 Balancing a Transportation Problem if Total Supply Exceeds Total Demand
Plant 1
Plant 3
City 1
City 2
City 3
City 4
Supply Pointsd1 = 35
Plant 2
xij
Dummy5
s1 = 35 d2 = 20
1154
1
=∑=j
jd
1253
1=∑
=iis s2 = 50
d3 = 30
s3 = 40
d4 = 30
d5 = 10c15 = c25 =c35 = 0
12
L. Ntaimo (c) 2005 INEN420 TAMU
7.2 Balancing a Transportation Problem if Total Supply is Less than Total Demand
In this case the problem has no feasible solution: demand cannot be satisfied
However, it is sometimes desirable to allow the possibility of leaving some demand unmet:
(1) A penalty (cost) is often associated with the unmet demand
(2) To balance the problem, add a “dummy (or shortage) supply point”
13
L. Ntaimo (c) 2005 INEN420 TAMU
7.3 Transportation Tableau
A transportation problem is specified by supply, the demand, and the shipping costs, so the relevant data can be summarized in a “transportation tableau”:
j 1 2 n
c11 c1n
c21
c12
c22 c2n
cm1 cmncm2
.
.
.
.
.
.
.
.
.
.
.
.
. . .
. . .
. . .
. . .
i1 s1
2 s2
Cell: (row i, col j)
smm
d2 dnd1
14
L. Ntaimo (c) 2005 INEN420 TAMU
7.3 Powerco Transportation Tableau
• If xij is a bv, its value is placed in the lower left-hand corner of the ijth cell
8 6 9 1010 3525
9 12 13 75045 5
14 9 16 5 4010 30
45 20 30 30
15
L. Ntaimo (c) 2005 INEN420 TAMU
7.4 Finding BFS’s for Transportation Problems
Consider a transportation with m supply points and n demand points
- Such a problem contains m + n equality constraints
- Recall: In the Big M method and Two-phase simplex method it is difficult to find a bfs if all of the LP’s constraints are equalities
- Fortunately, the structure of the transportation problems makes it easy to find a bfs
Important Observation
If a set of values for the xij’s satisfies all but one of the constraints of a balanced transportation problem, then the values for the xij’s will automatically satisfy the other constraints.
16
L. Ntaimo (c) 2005 INEN420 TAMU
7.4 Powerco Problem Formulation
)4,3,2,1;3,2,1( 0 30 30 20 45
40 50 35 s.t.
516914 713129 9106 8Min
342414
332313
322212
312111
34333231
24232221
14131211
34333231
24232221
14131211
==≥=++=++=++=++
=+++=+++=+++
+++++++++++
jixxxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
ij
Supply Constraints
Demand Constraints
Minimize total shipping costs
Omit this constraint
0. toequal ablesother vari ,30,10,5,45,10,10,1020
:solution Optimal
343223211312
allxxxxxxz =======
17
L. Ntaimo (c) 2005 INEN420 TAMU
7.5 Powerco ExampleRecall: s1 = 35, s2 = 50, s3 = 40,
d1 = 45, d2 = 20, d3 = 30, d4 = 30
Let a set of xij’s satisfy all constraints except the first supply constraint.
Then this set of xij’s must supply
d1 + d2 + d3 + d4 = 125 million kwh to cities 1 to 4
and supply
s2 + s3 = 125 – s1 = 90 million kwh from plants 2 and 3.
Thus plant 1 must supply
125 – (125 – s1) = 35 million kwh,
So the xij’s must satisfy the first supply constraint!
Therefore, we arbitrarily assume that the first constraint is omitted from consideration.
18
L. Ntaimo (c) 2005 INEN420 TAMU
7.5 Loop
Definition:
An ordered sequence of at least 4 different cells is called a loop if
1. Any 2 consecutive cells lie in either the same row or same column
2. No 3 consecutive cells lie in the same row or column
3. The last cell in the sequence has a row or column in common with the first cell in the sequence
Path: (1,1)-(1,2)-(2,3)-(2,1)Loop or Path?
Loop: (2,1)-(2,4)-(4,4)-(4,1) Loop: (1,1)-(1,2)-(2,2)-(2,3)-
(4,3)-(4,5)-(3,5)-(3,1)Path: (1,1)-(1,2)-(1,3)-(2,3)-(2,1)
19
L. Ntaimo (c) 2005 INEN420 TAMU
7.5 Theorem
In a balanced transportation problem with m supply points and ndemand points, the cells corresponding to a set of (m + n – 1) variables contain no loop iff the (m + n – 1) variables yield a basic solution
This follows from the fact that a set of (m + n – 1) cells contains no loop iff the
(m + n – 1) columns corresponding to these cells are linearly independent.
Example: Loop: (1,1)-(1,2)-(2,2)-(2,1)
4
5
3 2 4
Because (1,1)-(1,2)-(2,2)-(2,1) is a loop, the Theorem tells us that
{x11, x12, x22, x21} cannot yield a bfs for this transportation problem.
20
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 The Northwest Corner Method for Finding a BFS for a Balanced Transportation Problem
Begin in the upper left (or northwest) corner of the transportation tableau
Set x11 as large as possible. Clearly x11 = min{s1, d1}.
If x11= s1, cross out row 1 of the transportation tableau; no more bv’s will come from row 1. Also set d1 = d1 - s1.
If x11= d1, cross out the column 1 of the transportation tableau; no more bv’s will come from column 1. Also set s1 = s1 - d1.
If x11= s1 = d1, cross out either row 1 or column 1 (but NOT both).
If you cross out row 1, set d1 = 0.
If you cross out column 1, set s1 = 0.
Continue applying this procedure to the most northwest corner cell in the tableau that does not lie in a crossed-out row or column. Eventually, will come to a point where there is only one cell that can be assigned a value.
Assign this cell a value equal to its row or column demand, and cross out both the cell’s row and column.
A BFS has now been obtained.
21
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 Powerco Example: Finding a BFS8 6 9 10
35 - 3535
9 12 13 750
14 9 16 540
45 - 35 20 30 30
8 6 9 10x3550
9 12 13 7
4014 9 16 5
10 20 30 30
22
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 Powerco Example: Finding a BFS8 6 9 10
X35
9 12 13 710 50 - 10
14 9 16 540
10 - 10 20 30 30
8 6 9 10x35
9 12 13 74010
14 9 16 540
X 20 30 30
23
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 Powerco Example: Finding a BFS8 6 9 10
X35
9 12 13 710 40 - 2020
14 9 16 540
X 320 - 20 30 0
8 6 9 10x35
9 12 13 72010 20
14 9 16 540
X 3X 30 0
24
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 Powerco Example: Finding a BFS8 6 9 10
X35
9 12 13 710 20 20
20 - 2014 9 16 5
40
X 3X 30 - 20 0
8 6 9 10x35
9 12 13 7X10 20 20
14 9 16 540
X 3X 10 0
25
L. Ntaimo (c) 2005 INEN420 TAMU
Powerco Example: Finding a BFS8 6 9 10
X35
9 12 13 7X10 20 20
14 9 16 510 40 -10
X 3X 10 -10 0
8 6 9 10x35
9 12 13 7X10 20 20
14 9 16 53010
X 3X X 0
26
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 Powerco Example: Finding a BFS8 6 9 10
X35
9 12 13 7X10 20 20
14 9 16 530 - 30
1030
X 3X X 0 - 30
8 6 9 1035 X
9 12 13 7X10 20 20
14 9 16 5X10 30
X X X X
27
L. Ntaimo (c) 2005 INEN420 TAMU
7.6 Powerco Example: Basic Feasible Solution
8 6 9 1035 35
9 12 13 710 5020 20
14 9 16 510 30
40
45 20 30 30
BFS: x11 = 35
x22 = 10
x22 = 20
x23 = 20
x33 = 10
x34 = 30
NOTE: The BFS does NOT form a LOOP
28
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 The Transportation Simplex Method
Pricing Out Nonbasic Variables Recall:
.variablesbasic ofset dropped)been has constraintsupply first that the(assuming
LP, original in the for column
,for t coefficien objective where,
,
by given is cost) (reduced 0 Row s tableau'in the variable theoft coefficien The1
=
=
=
−= −
BV
xa
xc
caBcc
x
ijij
ijij
ijijBVij
ij
E.NONPOSITIV
are variablesnonbasic theallfor s' theif optimal be willbfscurrent theproblem, ONMINIMIZATI a solving are weSince
ijc
. POSITIVEmost with the variablenonbasic thebasis theinto ENTER weOtherwise,
ijc
29
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 The Transportation Simplex Method Cont..
s.constraint demand the toingcorrespond of elements theare ,...,,
s;constraintsupply 1 the toingcorrespond of elements theare ,... , where
,] ... ... [
:elements )1( have willdropped,been has constraintfirst theBecause
. computeeasily can we, gdetermininAfter
121
1 ,32
21 321
1
nBcvvv
m-Bcuuu
vvvuuuBc
n-m
cBc
BVn
BVm
nmBV
ij-
BV
−
−
− =
+
30
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 The Transportation Simplex Method Cont..
solve! easy to very are (1) equations theproblem,ation transportaFor
(1) 0
),(in variablesbasic 1 theofeach for Thus .0
havemust variablebasiceach u,any tableain fact that theuse we, determine To
1
1
=−
+=−
ijijBV
ij
ij-
BV
caBc
BVn-m c
xBc
. variablesbasic allfor
,0
:equations of system following thesolvemust we,for solve toThus,
. variablesbasic allfor
toreduces (1) that see will we,0set weIf
1
1
1
ijji
-BV
ijjiijijji
cvuu
nmBc
cvuccvu u
=+=
+
−+=⇒=+=
31
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 Powerco Example: Solution of (1)We start with the BFS obtained by applying the NW Corner method:
8 6 9 1035 35
9 12 13 710 5020 20
14 9 16 510 30
40
45 20 30 30
slides) 2next (See
:following obtain the we0 Applying
}, , , , ,{ bfs, For this
1
343323222111
=
=
ijij-
BV -caBc
xxxxxx BV
32
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 Powerco Example: Solution of (1) Model
088
000100
] [ 143213211 ==−
⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
= -vvvvvuuc
099
000101
] [ 1243213221 =+=−
⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
= -vuvvvvuuc
01212
001001
] [ 2243213222 =+=−
⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
= -vuvvvvuuc
01313
010001
] [ 3243213223 =+=−
⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
= -vuvvvvuuc
01616
010010
] [ 3343213233 =+=−
⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
= -vuvvvvuuc
055
100010
] [ 4343213234 =+=−
⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
= -vuvvvvuuc
0 Applying
}, , , , ,{1
343323222111
=
=
ijij-
BV -caBc
xxxxxx BV
33
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 Powerco Example: Solution of (1)We start with the BFS obtained by applying the NW Corner method:
8 6 9 1035 35
9 12 13 710 5020 20
14 9 16 510 30
40
45 303020
5 16 13 12 9 8
,0 :solvingby find We
43
33
32
22
12
11
1
1
=+=+=+=+=+=+
=
vuvuvuvuvuvu
uBc -
BV
34
L. Ntaimo (c) 2005 INEN420 TAMU
7.8 Powerco Example: Solution of (1)
69114 21484
5711 8910 210120
56110 :obtain weand
compute now we variable,nonbasiceach For
32
31
24
14
13
12
=−+=−=−+=
−=−+=−=−+==−+==−+=
−+=
cccccc
cvu c ijjiij
5 16 13 12 9 8
,0 :solvingby find We
43
33
32
22
12
11
1
1
=+=+=+=+=+=+
=
vuvuvuvuvuvu
uBc -
BV
1 4 12 11 1 8
:obtain We
4
3
3
2
2
1
======
vuvvuv Entering Nonbasic Variable
$6.by cost sPowerco' decrease willbasis theinto entered is that ofunit Each :Note
basis. theinto enter next wouldwe
, positivemost theis Because
32
32
32
x
x
cc ij
35
L. Ntaimo (c) 2005 INEN420 TAMU
7.9 How to Pivot in a Transportation Problem
Step 1: Determine the variable that should enter the basis
Step 2: Find the loop involving the entering variable and some of thebasic variables. (It can be shown that there is only one loop)
Step 3: Counting only cells in the loop, label those found in Step 2 thatare an even number (0, 2, 4, …) cells away from the entering variable as even cells. Also label those that are an odd numberof cells away from the entering variable as odd cells.
Step 4: Find the odd cell whose variable assumes the smallest value.Call this value θ. The variable corresponding to this cell will leavethe basis.
To perform the pivot, decrease the value of each odd cell by θand increase the value of each even cell by θ. The values of variablesnot in the loop remain unchanged. The pivot is now complete!
36
L. Ntaimo (c) 2005 INEN420 TAMU
7.9 How to Pivot in a Transportation Problem Cont…
Degenerate Solution:
In Step 4 if θ = 0, then the entering variable will equal 0, and an odd variable that has a current value of 0 will leave the basis.
In this case, a degenerate bfs existed before and will result after the pivot.
If more that one odd cell in the loop equals θ, you may arbitrarily chooseone of these to leave the basis, again, a degenerate bfs will result.
37
L. Ntaimo (c) 2005 INEN420 TAMU
7.10 Summary of the Transportation Simplex Method
Step 1: If the problem is unbalanced, balance it.
Step 2: Use the northwest corner method to find a bfs.
Step 3: Use the fact that u1 = 0 and ui + vj = cij for all basic variables to find[u1 u2 … um v1 v2 … vn] for the current bfs.
Step 4: If ui + vj - cij ≤ 0 for all nonbasic variables, then the current bfs is optimal. If this is not the case, then we enter the variable with the most positiveui + vj - cij into the basis using the pivoting procedure. This yields a new bfs.
Step 5: Using the new bfs, return to steps 3 and 4.
Step 4’: If ui + vj - cij ≥ 0 for all nonbasic variables, then the current bfs is optimal. Otherwise, enter the variable with the most negative ui + vj - cij into the basis using the pivoting procedure. This yields a new bfs.
For a maximization problem proceed as stated, but replace step 4 by Step 4’:
38
L. Ntaimo (c) 2005 INEN420 TAMU
7.11 Example: Powerco Problem
69114 21484
5711 8910 210120
56110 :obtain and
compute we variable,nonbasiceach For
32
31
24
14
13
12
=−+=−=−+=
−=−+=−=−+==−+==−+=
−+=
cccccc
cvu c ijjiij
basis. theinto enter next wouldwe
, positivemost theis Because
32
32
x
cc ij
We start with the initial bfs obtained by using theNW corner method:
Table 18 6 10 9
35 35
9 12 13 710 20 5020
10
5 16 13 12 9 8
,0 :solvingby foundalready have We
43
33
32
22
12
11
1
1
=+=+=+=+=+=+
=
vuvuvuvuvuvu
uBc -
BV
1 4 12 11 1 8 :Solution
4
3
3
2
2
1
======
vuvvuv
45 303020
14 9 16 530 40
2) Table (see 10by and increase and 10,by and decrease
pivot will the20, and 10 Because(2,2). and (3,3) are loop in this cells odd The
(2,2).-(2,3)-(3,3)-(3,2) :1 Tablein shown is sbv' theof some and involving The
23
322233
2233
32
xxxx
xx
xloop
==
39
L. Ntaimo (c) 2005 INEN420 TAMU
7.11 Example: Powerco Problem
616122 81482
1771 2970 210120
56110 :obtain and
compute we variable,nonbasiceach For
33
31
24
14
13
12
−=−+−=−=−+−=
=−+=−=−+==−+==−+=
−+=
cccccc
cvu c ijjiij
basis. theinto enter next wouldwe
, positivemost theis Because
12
21
x
cc ij
Table 28 6 10 9
35
10
35
5 9 13 12 9 8
,0 :solvingby find We
43
23
32
22
12
11
1
1
=+=+=+=+=+=+
=
vuvuvuvuvuvu
uBc -
BV
7 2
12 11 1 8 :Solution
4
3
3
2
2
1
=−=
====
vuvvuv
45 303020
9 12 13 710 30 50
14 9 16 510 30 40
3). Table (see 10by and increase and 10,by and decrease pivot will the
cell, oddan in entry smallest theis 10 Because(1,1). and (2,2) are loop in this cells odd The
(1,1).-(2,1)-(2,2)-(1,2) :2 Tablein shown is sbv' theof some and involving The
2112
1122
22
12
xxxx
x
xloop
=
40
L. Ntaimo (c) 2005 INEN420 TAMU
7.11 Example: Powerco Problem
416120 61480
1751 51261
4950 210120
:obtain and
compute we variable,nonbasiceach For
33
31
24
22
14
13
−=−+=−=−+=−=−+=−=−+=−=−+==−+=
−+=
cccccc
cvu c ijjiij
basis. theinto enter next wouldwe
, positivemost theis Because
13
13
x
cc ij
Table 38 6 10 9
5 6 6 13 9 8
,0 :solvingby find We
43
23
21
32
12
11
1
1
=+=+=+=+=+=+
=
vuvuvuvuvuvu
uBc -
BV
5 0 12 6 1 8 :Solution
4
3
3
2
2
1
======
vuvvuv
45 303020
9
25
20
10 35
12 13 730 50
14 9 16 510 30 40
4). Table (see 25by and increase and 25,by and decrease pivot will the
cell, oddan in entry smallest theis 25 Because(1,1). and (2,3) are loop in this cells odd The
(1,1).-(2,1)-(2,3)-(1,3) :3 Tablein shown is sbv' theof some and involving The
2113
1123
11
13
xxxx
x
xloop
=
41
L. Ntaimo (c) 2005 INEN420 TAMU
7.11 Example: Powerco Problem
316103 51463
2723 31263
4950 2860
:obtain and
compute we variable,nonbasiceach For
33
31
24
22
14
11
−=−+=−=−+=−=−+=−=−+=−=−+=−=−+=
−+=
cccccc
cvu c ijjiij
Table 48 6 10 9
10 25 35
9 12 13 745 5 50
14 9 16 510 30 40
.020,1$ )30(5)10(9)5(13)45(9)25(10)10(6
and,30,10,5,45,25,10
:is problem Powerco theosolution t optimal theThus obtained.been
hassolution optimalan 0, all Because
343223211312
=+++++=
======
≤
z
xxxxxx
cij45 20 30 30
9 10 13 6 5 9
,0 :solvingby find We
23
31
32
21
43
12
1
1
=+=+=+=+=+=+
=
vuvuvuvuvuvu
uBc -
BV
2 3 10 6 3 6 :Solution
4
3
3
2
2
1
======
vuvvuv
42
L. Ntaimo (c) 2005 INEN420 TAMU
7.12 Assignment Problems
1. Problem Description2. Example Formulation3. The Hungarian Method4. Example using the Hungarian Method5. Transshipment Problems
43
L. Ntaimo (c) 2005 INEN420 TAMU
7.12 On the integrality Property of the Transportation Problem
• We already know the fact that solutions to the transportation problem are integral. This is a useful property of the transportation problem.
• In general, solutions to integer programs with the integer restrictions relaxed are fractional (linear programming (LP) relaxation).
e.g. x1 + x2 = 1, x1 – x2 = 0, has the unique solution (x1 = 0.5, x2 = 0.5)
• But solutions to the transportation problem are integral.
• In general, if there is at most one 1 and at most one –1 in any column of the constraint matrix (unimodular constraint matrix), then every basic feasible solution is integer (so long as RHS is integral.)
44
L. Ntaimo (c) 2005 INEN420 TAMU
7.12 A special case of the Transportation Problem: Supplies and Demands are All Equal to 1.
Supply Demand Supply Demand
11 411
1
1
1
1
2
3
4
5
6
1
1
1
0
1
1
0
2
1
1
2
22
6
1
1
1
3
5
1
1
1
A solution to this transportation problem may be viewed as an “assignment”
45
L. Ntaimo (c) 2005 INEN420 TAMU
7.12 The Assignment Problem
•3 people: nodes 1, 2, 3
1
2
3
P
4
5
6
T/J
1
1
1
1
1
11
0
1
1
0
21
2
2
•3 tasks (jobs): nodes 4, 5, 6
•Each person must be assigned to a task
•Each task has a person assigned
•Cost of assigning a person to a task
•Objective: meet constraints while minimizing total cost
Formulate this as an integer program or IP.
(Note that all variables are required to be integer).
46
L. Ntaimo (c) 2005 INEN420 TAMU
7.13 Assignment Problem
• Suppose that n people (let us label them 1 to n) are assigned to n tasks (also let us label them labeled 1 to n). Then,
– let xij = 1 if person i is assigned to task j
– let xij = 0 if person i is not assigned to task j
– let cij be the cost of assigning person i to task j
• Formulate the assignment problem
47
L. Ntaimo (c) 2005 INEN420 TAMU
7.13 The Assignment Problem
In general the LP formulation is given as
Minimize
s.t.
1 1
1
1
1 1
1 1
0
, , ,
, , ,
or 1,
n n
ij iji j
n
ijj
n
iji
ij
c x
x i n
x j n
x ij
= =
=
=
= ∀ =
= ∀ =
= ∀
∑∑
∑
∑
…
…
Each supply is 1
Each demand is 1
48
L. Ntaimo (c) 2005 INEN420 TAMU
7.14 Example Problem
Machineco has 4 machines and 4 jobs to be completed. Each machine must be assigned to complete one job. The time required to set up each machine for completing each job is shown in Table 1. Machineco wants to minimize the total setup time needed to complete the 4 jobs. Formulate this problem as an LP.
Table 1Time (Hours)
Machine Job 1 Job 2 Job 3 Job 41 14 5 8 72 2 12 6 53 7 8 3 94 2 4 6 10
49
L. Ntaimo (c) 2005 INEN420 TAMU
7.14 Example Problem Formulation
Machineco must determine which machine should be assigned to each job. Let the decision variables be defined as:
jix
jix
ij
ij
job of demands meet the toassignednot is machine if 0
job of demands meet the toassigned is machine if 1
=
=
14131211
14131211
14131211
14131211
10642 9387
56122 78514Min
xxxxxxxxxxxxxxxxz
+++++++++++++++=
1 1 1
)contraints (Machine 1 s.t.
44434241
34333231
24232221
14131211
=+++=+++=+++=+++
xxxxxxxxxxxxxxxx
Ensures that each machine is assigned to one job
).4,3,2,1;4,3,2,1(,0or 1 1 1 1
)contraints (Job 1
44342414
43332313
42322212
41312111
=====+++=+++=+++=+++
jixxxxxxxxxxxxxxxxxx
ijij
Ensures that each job is assigned to one machine (each job is completed)
50
L. Ntaimo (c) 2005 INEN420 TAMU
7.15 Relaxing Integrality Requirements
Since all the supplies and demands for the assignment problem are integers, our discussion of the transportation simplex method implies that all variables in an optimal solution of a transportation problem must be integers
Since each RHS of each constraint is equal to 1, each xij must be a nonnegative integer that is no larger than 1 , so each xij must be equal to 0 or 1
Therefore, we can remove the integrality requirements on the decision variables
51
L. Ntaimo (c) 2005 INEN420 TAMU
7.15 Solution Approach
A high degree of degeneracy in an assignment problem may cause the transportation simplex to be an inefficient way of solving assignment problems.
For this reason, and the fact that the algorithm is even much simpler than the transportation simplex, the Hungarian method is usually used to solve assignment (min) problems
Note: If your assignment is a max problem, convert it to a min problem before applying the Hungarian Method.
52
L. Ntaimo (c) 2005 INEN420 TAMU
7.15 The Hungarian Method
Step 1. Find the minimum element in each row of the m x m cost matrix. Construct a new matrix by subtracting from each cost the minimum cost in its row. For this new matrix, find the minimum cost in each column. Construct a new matrix (called the reduced cost matrix) by subtracting from each cost the minimum cost in its column.
Step 2. Cover all the zeros in the reduced cost matrix using the minimum number of lines needed. If m lines are required, then an optimal solution is available among the covered zeros in the matrix. If fewer than m lines are needed, then proceed to Step 3.
Step 3. Find the smallest nonzero element (k) in the reduced cost matrix that is uncovered by the lines drawn in Step 2. Now subtract k from each uncovered element and add k to each element that is covered by two lines. Return to Step 2.
53
L. Ntaimo (c) 2005 INEN420 TAMU
7.15 Remarks on the Hungarian Method
To solve an assignment problem in which the goal is to maximize the objective function, multiply the profits matrix by -1 and solve the problem as a minimization problem
If the number of rows and columns in the cost matrix are unequal, then the assignment problem is unbalanced. The Hungarian method may yield an incorrect solution if the problem is unbalanced. Thus, any assignment problem should be balanced (by the addition of one or more dummy points) before it is solved by the Hungarian method.
54
L. Ntaimo (c) 2005 INEN420 TAMU
7.16 Machineco Example
14 5 8 7
2 12 6 5
7 8 3 9
2 4 6 10
Job 1 Job 2 Job 3 Job 4
Machine 1
Machine 2
Machine 3
Machine 4
Table 2. Machineco Cost Matrix
55
L. Ntaimo (c) 2005 INEN420 TAMU
7.16 Machineco Example
14 5 8 7
2 12 6 5
7 8 3 9
2 4 6 10
5
Row Minimum
2
3
2
Table 3. Machineco Cost Matrix
9 0 3 0
0 10 4 1
4 5 0 4
0 2 4 6
Table 5. Cost Matrix After Column Mins are Subtracted
3 lines with smallest uncovered element equals 1
9 0 3 2
0 10 4 3
4 5 0 6
0 2 4 8
Table 4. Cost Matrix After Row Mins are Subtracted
10 0 3 0
0 9 3 0
5 5 0 4
0 1 3 5
Table 6. Four lines required: optimal solution found
0 00 2.1,1,1,1 :Assignment Optimal 41332412 ==== xxxx
Column Minimum
56
L. Ntaimo (c) 2005 INEN420 TAMU
7.17 Transshipment Problems
A transportation problem allows only shipments that go directly from supply points to demand points.
In many situations, shipments are allowed between supply points or between demand points.
Sometimes there may also be points (called transshipment points) through which goods can be transshipped on their journey from a supply point to a demand point.
Fortunately, the optimal solution to a transshipment problem can be found by solving a transportation problem.
57
L. Ntaimo (c) 2005 INEN420 TAMU
7.17 Widgetco Example: See problem description on page 400
Memphis New York
Denver Boston
Los Angeles
Chicago
150
200
130
130
Demand
Total = 260Supply
Total = 350
58
L. Ntaimo (c) 2005 INEN420 TAMU
7.18 Converting a Transshipment Problem into a Balanced Transportation problem
(assuming supply >= demand)
Step1. If necessary, add a dummy demand point (with a supply of 0 and a demand equal to the problem’s excess supply) to balance the problem. Shipments to the dummy and from a point to itself will be zero. Let s= total available supply.
Step2. Construct a transportation tableau as follows: A row in the tableau will be needed for each supply point and transshipment point, and a column will be needed for each demand point and transshipment point.
59
L. Ntaimo (c) 2005 INEN420 TAMU
7.18 Converting a Transshipment Problem into a Balanced Transportation problem
Step2. Cont..
Each supply point will have a supply equal to it’s original supply, and each demand point will have a demand to its original demand.
Let s= total available supply. Then each transshipment point will have a supply equal to (point’s original supply) + s and a demand equal to (point’s original demand) + s. This ensures that any transshipment point that is a net supplier will have a net outflow equal to point’s original supply and a net demander will have a net inflow equal to point’s original demand.
Although we don’t know how much will be shipped through each transshipment point, we can be sure that the total amount will not exceed s.
60
L. Ntaimo (c) 2005 INEN420 TAMU
7.19 Widgeco Example: As a Balanced Transportation Problem
130 20
130 70
220 130
350
N.Y. Chicago L.A. Boston Dummy
8 13 25 28 0
Memphis 150
15 12 26 25 0Denver 200
0 6 16 17 0N.Y 350
6 0 14 16 0Chicago 350
350 350 130 130 90
61
L. Ntaimo (c) 2005 INEN420 TAMU
References
Winston, Wayne L. and M. Venkataramanan, Introduction to Mathematical Programming, 4th Edition, Duxbury Press, Belmont, CA, 2003.
62
L. Ntaimo (c) 2005 INEN420 TAMU
Powerco Problem Formulation back
)4,3,2,1;3,2,1( 0 30 30 20 45
40 50 35 s.t.
516914 713129 9106 8Min
342414
332313
322212
132111
34333231
24232221
14131211
34333231
24232221
14131211
==≥≥++≥++≥++≥++
≤+++≤+++≤+++
+++++++++++
jixxxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
ij
Supply Constraints
Demand Constraints
Minimize total shipping costs
u1
u2u3
v1
v2
v3
v4