# ---------------------------------------- # BENDERS DECOMPOSITION FOR # THE LOCATION-TRANSPORTATION PROBLEM # ---------------------------------------- reset; model trnloc01d.mod; data trnloc01.dat; option solver cplex; option cplex_options 'mipdisplay 2 mipinterval 100 primal'; option omit_zero_rows 1; option display_eps .00000001; problem Master: Build, Max_Ship_Cost, Total_Cost, Cut_Defn; problem Sub: Supply_Price, Demand_Price, Dual_Ship_Cost, Dual_Ship; #suffix unbdd OUT; let nCUT := 0; let Max_Ship_Cost := 0; let {i in ORIG} build[i] := 1; param GAP default Infinity; repeat { printf "\nITERATION %d\n\n", nCUT+1; solve Sub; printf "\n"; if Dual_Ship_Cost - Max_Ship_Cost <= 0.000001 then break; let GAP := min (GAP, Dual_Ship_Cost - Max_Ship_Cost); option display_1col 0; display GAP, Dual_Ship; let nCUT := nCUT + 1; let {i in ORIG} supply_price[i,nCUT] := Supply_Price[i]; let {j in DEST} demand_price[j,nCUT] := Demand_Price[j]; printf "\nRE-SOLVING MASTER PROBLEM\n\n"; solve Master; printf "\n"; option display_1col 20; display Build; let {i in ORIG} build[i] := Build[i]; }; option display_1col 0; display Dual_Ship;