# ---------------------------------------- # cfl.benders.cmd (command file) # Benders Decomposition for the # Capacitated Facility Location # ---------------------------------------- model cfl.benders.mod; data cfl1.dat; option cplex_options 'mipdisplay 1 mipinterval 100 presolve 0'; #option omit_zero_rows 1; #option display_eps .000001; problem Master: Build, Max_Ship_Cost, Total_Cost, Cut_Point, Cut_Ray; problem Sub: Supply_Price, Demand_Price, Dual_Ship_Cost, Dual_Ship; suffix unbdd OUT; param GAP default Infinity; let nCUT := 0; let Max_Ship_Cost := 0; let {i in ORIG} build[i] := 1; repeat { printf "\nITERATION %d\n\n", nCUT+1; solve Sub; printf "\n"; if Dual_Ship_Cost <= Max_Ship_Cost + 0.00001 then break; if Sub.result_num = 300 then { printf "UNBOUNDED\n"; let nCUT := nCUT + 1; let cut_type[nCUT] := "ray"; let {i in ORIG} supply_price[i,nCUT] := Supply_Price[i].unbdd; let {j in DEST} demand_price[j,nCUT] := Demand_Price[j].unbdd; } else { let GAP := min (GAP, Dual_Ship_Cost - Max_Ship_Cost); option display_1col 0; display GAP; # Dual_Ship; let nCUT := nCUT + 1; let cut_type[nCUT] := "point"; 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;