Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- model;
- # Sets
- set MINES;
- set PLANTS;
- set CUSTOMERS;
- set CAPACITIES;
- # Parameters
- param supply {MINES}; # Table for coke supply at each mine
- param demand {CUSTOMERS}; # Table for coke demand at each customer
- param tp_mines_plants {MINES, PLANTS}; # Table of shipping costs from mines to plants
- param tp_plants_custs {CUSTOMERS, PLANTS}; # Table of shipping costs from plants to customers
- param sizes {CAPACITIES};
- param costs {CAPACITIES};
- # Variables
- var shipped_mp {MINES, PLANTS} >= 0; # Table of amount shipped from each mine to each plant
- var shipped_pc {CUSTOMERS, PLANTS} >= 0; # Table of amount shipped from each plant to each cust
- var build {PLANTS, CAPACITIES} binary; # Binary,{0,1}
- # Objective
- minimize TotalCost :
- sum {i in PLANTS, j in CAPACITIES} build[i,j] * costs[j] +
- sum{i in MINES, j in PLANTS} tp_mines_plants[i,j] * shipped_mp[i,j] +
- sum{i in CUSTOMERS, j in PLANTS} tp_plants_custs[i,j] * shipped_pc[i,j];
- ################## Constraints
- # Constraint on flow leaving mines
- subject to flowLeavingMines {i in MINES} :
- sum {j in PLANTS} shipped_mp[i,j] <= supply[i];
- # Constraint on flows entering demand
- subject to flowEnteringCusts {i in CUSTOMERS} :
- sum {j in PLANTS} shipped_pc[i,j] >= demand[i];
- # Constraint on flow entering plants
- subject to flowsEnteringPlants {i in PLANTS} :
- sum {j in MINES} shipped_mp[j,i] / 1.3
- <= sum {k in CAPACITIES} sizes[k] * build[i,k];
- # Constraint on flow leaving plants
- subject to flowsLeavingPlants {i in PLANTS} :
- sum {j in CUSTOMERS} shipped_pc[j,i]
- <= sum {k in CAPACITIES} sizes[k] * build[i,k];
- # Constraint for conservation of flow
- subject to flowConservation {i in PLANTS} :
- sum {j in MINES} shipped_mp[j,i] / 1.3
- = sum {k in CUSTOMERS} shipped_pc[k,i];
- # Constraint on number of plants at a location
- subject to plantsAtLocation {i in PLANTS} :
- sum {j in CAPACITIES} build[i,j] <= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement