Lab 7 - University of Toronto Department of Mechanical and...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: University of Toronto Department of Mechanical and Industrial Engineering MIE376: Mathematical Programming Winter 2011 Lab 7 – Dantzig‐Wolfe Decomposition 1. Multi‐Commodity Transportation Model Suppose that we have a transportation problem in which we have to ship steel bands, coils and plates from 3 supplying cities to 7 demand cities. The supply and demand are as follows: Supplier Bands Coils Plates Gary, Indiana 400 800 200 Cleveland, Ohio 800 1600 300 Pittsburgh, Pennsylvania 200 1800 300 Demand Bands Coils Plates Framingham, Massachusetts 300 500 100 Detroit, Michigan 300 750 100 Lansing, Michigan 100 400 0 Windsor, Ontario 75 250 50 St. Louis, Missouri 650 950 200 Fremont, California 225 850 100 Lafayette, Indiana 250 500 250 Shipping Cost for Bands/Coils/Plates From/To Framingham Detroit Lansing Windsor St. Louis Fremont Lafayette Gary 30/39/41 10/14/15 8/11/12 10/14/16 11/16/17 71/82/86 6/8/8 Cleveland 22/27/29 7/9/9 10/12/13 7/9/9 21/26/28 82/95/99 13/17/18 Pittsburgh 19/24/26 11/14/14 12/17/17 10/13/13 25/28/31 83/99/104 15/20/20 For Steel Bands, the Associating Constraints in the Multi‐Commodity Transportation Model can be formulated with constraint sets: i) GARY:FRAM + CLEV:FRAM + PITT:FRAM ≥ 300 ii) GARY:DET + CLEV:DET + PITT:DET ≥ 300 iii) GARY:LAN + CLEV:LAN + PITT:LAN ≥ 100 iv) GARY:WIN + CLEV:WIN + PITT:WIN ≥ 75 v) …and etc. With the Centralized Constraints: i) GARY:FRAM + GARY:DET + GARY:LAN + … + GARY:LAF ≤ 400 ii) CLEV:FRAM + CLEV:DET + CLEV:LAN + … + CLEV:LAF ≤ 800 iii) PITT:FRAM + PITT:DET + GARY:LAN + … + PITT:LAF ≤ 200 Therefore, we can set up a DWD algorithm in AMPL to solve this problem. University of Toronto Department of Mechanical and Industrial Engineering MIE376: Mathematical Programming Winter 2011 2. Script for DWD (multi.run) For the Formulation Above, we can use a prewritten DWD script from the AMPL website to solve the problem: # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ # DANTZIG‐WOLFE DECOMPOSITION FOR # MULTI‐COMMODITY TRANSPORTATION # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ model multi1.mod; data multi1.dat; let nPROP := 0; let price_convex := 1; let {i in ORIG, j in DEST} price[i,j] := 0; option solver minos; option omit_zero_rows 1; option display_1col 10; option display_eps .000001; # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ problem MasterI: Artificial, Weight, Excess, Multi, Convex; problem SubI: Artif_Reduced_Cost, Trans, Supply, Demand; repeat { printf "\nPHASE I ‐‐ ITERATION %d\n\n", nPROP+1; solve SubI; printf "\n"; display Trans; if Artif_Reduced_Cost >= ‐ 0.00001 then { printf "\n*** NO FEASIBLE SOLUTION ***\n"; break; } else { let nPROP := nPROP + 1; let {i in ORIG, j in DEST} prop_ship[i,j,nPROP] := sum {p in PROD} Trans[i,j,p]; let prop_cost[nPROP] := sum {i in ORIG, j in DEST, p in PROD} cost[i,j,p] * Trans[i,j,p]; }; solve MasterI; printf "\n"; display Weight; display Multi.dual; display {i in ORIG, j in DEST} limit[i,j] ‐ sum {k in 1..nPROP} prop_ship[i,j,k] * Weight[k]; if Excess <= 0.00001 then break; else { let {i in ORIG, j in DEST} price[i,j] := Multi[i,j].dual; let price_convex := Convex.dual; }; }; # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ printf "\nSETTING UP FOR PHASE II\n\n"; problem MasterII: Total_Cost, Weight, Multi, Convex; problem SubII: Reduced_Cost, Trans, Supply, Demand; solve MasterII; printf "\n"; display Weight; display Multi.dual; display Multi.slack; let {i in ORIG, j in DEST} price[i,j] := Multi[i,j].dual; let price_convex := Convex.dual; repeat { printf "\nPHASE II ‐‐ ITERATION %d\n\n", nPROP+1; solve SubII; printf "\n"; display Trans; if Reduced_Cost >= ‐ 0.00001 then { printf "\n*** OPTIMAL SOLUTION ***\n"; break; } else { let nPROP := nPROP + 1; let {i in ORIG, j in DEST} prop_ship[i,j,nPROP] := sum {p in PROD} Trans[i,j,p]; let prop_cost[nPROP] := sum {i in ORIG, j in DEST, p in PROD} cost[i,j,p] * Trans[i,j,p]; }; solve MasterII; printf "\n"; display Weight; let {i in ORIG, j in DEST} price[i,j] := Multi[i,j].dual; let price_convex := Convex.dual; }; # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ printf "\nPHASE III\n\n"; problem MasterIII: Opt_Cost, Trans, Supply, Demand, Opt_Multi; let {i in ORIG, j in DEST} opt_ship[i,j] := sum {k in 1..nPROP} prop_ship[i,j,k] * Weight[k]; solve MasterIII; printf "\n"; display Trans; University of Toronto Department of Mechanical and Industrial Engineering MIE376: Mathematical Programming Winter 2011 3. .mod file (multi.mod) # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ # MULTI‐COMMODITY FLOW USING # DANTZIG‐WOLFE DECOMPOSITION # ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ### SUBPROBLEM ### set ORIG; # origins set DEST; # destinations set PROD; # products param supply {ORIG,PROD} >= 0; # amounts available at origins param demand {DEST,PROD} >= 0; # amounts required at destinations check {p in PROD}: sum {i in ORIG} supply[i,p] = sum {j in DEST} demand[j,p]; param price_convex; # dual price on convexity constr param price {ORIG,DEST} <= 0.000001; # dual price on shipment limit param cost {ORIG,DEST,PROD} >= 0; # shipment costs per unit var Trans {ORIG,DEST,PROD} >= 0; # units to be shipped minimize Artif_Reduced_Cost: sum {i in ORIG, j in DEST, p in PROD} (‐ price[i,j]) * Trans[i,j,p] ‐ price_convex; minimize Reduced_Cost: sum {i in ORIG, j in DEST, p in PROD} (cost[i,j,p] ‐ price[i,j]) * Trans[i,j,p] ‐ price_convex; subject to Supply {i in ORIG, p in PROD}: sum {j in DEST} Trans[i,j,p] = supply[i,p]; subject to Demand {j in DEST, p in PROD}: sum {i in ORIG} Trans[i,j,p] = demand[j,p]; ### MASTER PROBLEM ### param limit {ORIG,DEST} >= 0; # max shipped on each link param nPROP integer >= 0; param prop_ship {ORIG,DEST,1..nPROP} >= ‐0.000001; param prop_cost {1..nPROP} >= 0; # For each proposal from the subproblem: # amount it ships over each link, and its cost var Weight {1..nPROP} >= 0; var Excess >= 0; minimize Artificial: Excess; minimize Total_Cost: sum {k in 1..nPROP} prop_cost[k] * Weight[k]; subject to Multi {i in ORIG, j in DEST}: sum {k in 1..nPROP} prop_ship[i,j,k] * Weight[k] ‐ Excess <= limit[i,j]; subject to Convex: sum {k in 1..nPROP} Weight[k] = 1; ### PHASE III PROBLEM ### param opt_ship {ORIG,DEST} >= ‐0.000001; minimize Opt_Cost: sum {i in ORIG, j in DEST, p in PROD} cost[i,j,p] * Trans[i,j,p]; subject to Opt_Multi {i in ORIG, j in DEST}: sum {p in PROD} Trans[i,j,p] = opt_ship[i,j] 4. .dat file (multi.dat) set ORIG := GARY CLEV PITT ; set DEST := FRA DET LAN WIN STL FRE LAF ; set PROD := bands coils plate ; param supply (tr): GARY CLEV PITT := bands 400 700 800 coils 800 1600 1800 plate 200 300 300 ; param demand (tr): FRA DET LAN WIN STL FRE LAF := bands 300 300 100 75 650 225 250 coils 500 750 400 250 950 850 500 plate 100 100 0 50 200 100 250 ; param limit default 625 ; param cost := [*,*,bands]: FRA DET LAN WIN STL FRE LAF := GARY 30 10 8 10 11 71 6 CLEV 22 7 10 7 21 82 13 PITT 19 11 12 10 25 83 15 [*,*,coils]: FRA DET LAN WIN STL FRE LAF := GARY 39 14 11 14 16 82 8 CLEV 27 9 12 9 26 95 17 PITT 24 14 17 13 28 99 20 [*,*,plate]: FRA DET LAN WIN STL FRE LAF := GARY 41 15 12 16 17 86 8 CLEV 29 9 13 9 28 99 18 PITT 26 14 17 13 31 104 20 ; ...
View Full Document

This note was uploaded on 04/20/2011 for the course MIE 376 taught by Professor Daniel during the Spring '11 term at University of Toronto- Toronto.

Ask a homework question - tutors are online