Transportation Algorithm October 9, 2009
Outline Lecture 14 Revisit the transportation problem Simplex algorithm for the balanced problem Basic feasible solutions Selection of the initial basic feasible solution Computing reduced costs of nonbasic variables Basis change Operations Research Methods 1
Transportation Problem minimize subject to m n i=1 j=1 n j=1 m i=1 c ij x ij x ij = b i for i = 1,..., m x ij = d j for j = 1,..., n x ij 0 for all i, j We assume that the problem is balanced There are m + n linear equations (constraints) There are m n variables (x ij ) Every basic solution will have m + n 1 basic variables Operations Research Methods 2
MG Auto model Denver Miami Supply Los Angeles 80 215 1000 Detroit 100 108 1500 New Orleans 102 68 1200 Demand 2300 1400 minimize 80x 11 + 215x 12 + 100x 21 + 108x 22 + 102x 31 + 68x 33 subject to x 11 + x 12 = 1000 LA x 21 + x 22 = 1500 Detroit x 31 + x 32 = 1200 NewOrleans x 11 + x 21 + x 31 = 2300 Denver x 12 + x 22 + x 32 = 1400 Miami x ij 0 for all i, j Operations Research Methods 3
If we sum all of the supply equations and subtract the sum of all demand equations, we obtain 0 = 0. Hence, the system of equations is linearly dependent Consequentially, the system has one redundant equation Hence, any basic solution will use only n + m 1 equations In other words, every basic solution will have only m + n 1 basic variables Operations Research Methods 4
Selecting an Initial Basic Feasible Solution Several Algorithms exist We focus on: Northwest-corner method (water-filing) Start with the first supplier and go along the supplier list For each supplier: 1. Let the supplier allocate all of its resources to the demand centers going along the demand list 2. Allocation should satisfy the demand of each center until the supplier resources are exhausted Supply-Demand Table Denver Miami Supply Los Angeles 1000 Detroit 1500 New Orleans 1200 Demand 2300 1400 Operations Research Methods 5
The first supplier: let the supplier allocate all of its resources to fulfill the demands of the centers going along the list of the demand centers Resulting Table Denver Miami Supply Los Angeles 1000 0 Detroit 1500 New Orleans 1200 Demand 1300 1400 At this point the resources of the first supplier are exhausted Go to the second supplier Operations Research Methods 6
The second supplier: Allocate as much as possible to fulfill the remaining demand of Center 1 Denver Miami Supply Los Angeles 1000 0 Detroit 1300 200 New Orleans 1200 Demand 0 1400 Allocate as much as possible to fulfill the remaining demand of Center 2 Denver Miami Supply Los Angeles 1000 0 Detroit 1300 200 0 New Orleans 1200 Demand 0 1200 At this point all resources of the second supplier are exhausted. Go to the third supplier. Operations Research Methods 7
The third supplier: The demand of Center 1 is 0, so we look at Center 2 and allocate all the resources to that center Resulting basic feasible solution Denver Miami Supply Los Angeles 1000 0 Detroit 1300 200 0 New Orleans 1200 0 Demand 0 0 Denver Miami Supply Los Angeles x 11 = 1000 0 Detroit x 21 = 1300 x 22 = 200 0 New Orleans x 32 = 1200 0 Demand 0 0 Operations Research Methods 8
Simplex Method From the preceding solution, x 11, x 21, x 22, and x 32 as initial basic variables: Initial data table Basic x 11 x 12 x 21 x 22 x 31 x 32 RHS z -80-215 -100-108 -102-68 0 x 11 1 1 0 0 0 0 1000 x 21 1 0 1 0 1 0 2300 x 22 0 0 1 1 0 0 1500 x 32 0 0 0 0 1 1 1200 Operations Research Methods 9
Initial Simplex Table Basic x 11 x 12 x 21 x 22 x 31 x 32 RHS z 0-215 0 0-102 0 80 + 2.3 100 + 1.5 108 + 1.2 68 x 11 1 1 0 0 0 0 1000 x 21 0 0 1 0 1 0 1300 x 22 0 0 0 1 0 0 200 x 32 0 0 0 0 1 1 1200 We are extremely lucky the basic solution produced by the northwestcorner method is optimal! This is not always the case!!! Operations Research Methods 10
Sun-Ray Transportation Model Grain from Silos to Mills Northwest-corner method Mill 1 Mill 2 Mill 3 Mill 4 Supply Silo 1 10 2 20 11 15 Silo 2 12 7 9 20 25 Silo 3 4 14 16 18 10 Demand 5 15 15 15 Mill 1 Mill 2 Mill 3 Mill 4 Silo1 10 x 11 = 5 2 x 12 = 10 20 11 Silo 2 12 7 x 22 = 5 9 x 23 = 15 20 x 24 = 5 Silo 3 4 14 16 18 x 34 = 10 Working with the simplex method would require 12 variables, of which 6 are basic variables. We resort to a more compact representation: - the use of the preceding table. Operations Research Methods 11
Simplex Method Having the initial table (with initial basic feasible solution), we perform the typical simplex iteration Compute the reduced costs of the nonbasic variables Looking at the reduced cost values, we check the optimality If not optimal (reduced cost positive for some nonbasic variable), we perform change of basis and update the table Mill 1 Mill 2 Mill 3 Mill 4 Silo1 10 x 11 = 5 2 x 12 = 10 20 11 Silo 2 12 7 x 22 = 5 9 x 23 = 15 20 x 24 = 5 Silo 3 4 14 16 18 x 34 = 10 Operations Research Methods 12
Determining the reduced cost We do not have Basis Inverse, so we have to rely on the dual problem and the fact that the reduced costs of the basic variables are zero minimize subject to m n i=1 j=1 n j=1 m i=1 c ij x ij x ij = b i for i = 1,..., m (u i ) x ij = d j for j = 1,..., n (v j ) x ij 0 for all i, j Operations Research Methods 13
The dual of the general transportation problem maximize m b i u i + n i=1 j=1 d j v j subject to u i + v j c ij for all (i, j) pairs (x ij ) Operations Research Methods 14
Back to Sun-Ray Case: Reduced cost Mill 1 Mill 2 Mill 3 Mill 4 Silo1 10 x 11 = 5 2 x 12 = 10 20 11 Silo 2 12 7 x 22 = 5 9 x 23 = 15 20 x 24 = 5 Silo 3 4 14 16 18 x 34 = 10 To compute the reduced costs of nonbasic variables: Step 1: We determine the shadow prices of the problem corresponding to the current basic feasible solution: using the fact that the reduced costs of the basic variables are 0 Step 2: Using the shadow prices, we compute the reduced costs of the nonbasic variables Step 1 Shadow-price equations for the current solution u i + v j = c ij for each x ij currently in the basis Operations Research Methods 15
The equations are u 1 + v 1 = 10 u 1 + v 2 = 2 u 2 + v 2 = 7 u 2 + v 3 = 9 u 2 + v 4 = 20 u 3 + v 4 = 18 There are 7 unknowns and 6 equations. The system is under-determined, so we can choose one of the variables (free) Typically we set u 1 = 0 Operations Research Methods 16
Solving the equations with u 1 = 0 u 1 + v 1 = 10 & u 1 = 0 v 1 = 10 u 1 + v 2 = 2 u 1 = 0 v 2 = 2 u 2 + v 2 = 7 v 2 = 2 u 2 = 5 u 2 + v 3 = 9 u 2 = 5 v 3 = 4 u 2 + v 4 = 20 u 2 = 5 v 4 = 15 u 3 + v 4 = 18 v 4 = 15 u 3 = 3 Step 2 Using the shadow prices, compute the reduced costs c ij for nonbasic variables c ij = u i + v j c ij Mill 1 Mill 2 Mill 3 Mill 4 Silo1 10 x 11 = 5 2 x 12 = 10 20 11 Silo 2 12 7 x 22 = 5 9 x 23 = 15 20 x 24 = 5 Silo 3 4 14 16 18 x 34 = 10 Operations Research Methods 17
We have c 13 = u 1 + v 3 c 13 = 0 + 4 20 = 16 c 14 = u 1 + v 4 c 14 = 0 + 15 11 = 4 c 21 = u 2 + v 1 c 21 = 5 + 10 12 = 3 c 31 = u 3 + v 1 c 31 = 3 + 10 4 = 9 c 32 = u 3 + v 2 c 32 = 3 + 2 14 = 9 c 33 = u 3 + v 3 c 33 = 3 + 4 16 = 9 Question: Which nonbasic variables are candidates to enter the basis? Operations Research Methods 18
Answer The nonbasic variables with positive reduced cost: x 13 c 13 = 16 x 14 c 14 = 4 x 21 c 21 = 3 x 31 c 31 = 9 x 32 x 33 c 32 = 9 c 33 = 9 We can choose any of x 14, x 21, and x 31. We may choose the one with the largest reduced cost - x 31. The typical simplex iteration Compute the reduced costs of the nonbasic variables DONE Looking at the reduced cost values, we check the optimality DONE If not optimal (reduced cost positive for some nonbasic variable), perform change of basis and update the table TODO Operations Research Methods 19