Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. model;
  2.  
  3. # Sets
  4. set MINES;
  5. set PLANTS;
  6. set CUSTOMERS;
  7. set CAPACITIES;
  8.  
  9. # Parameters
  10. param supply {MINES}; # Table for coke supply at each mine
  11. param demand {CUSTOMERS}; # Table for coke demand at each customer
  12. param tp_mines_plants {MINES, PLANTS}; # Table of shipping costs from mines to plants
  13. param tp_plants_custs {CUSTOMERS, PLANTS}; # Table of shipping costs from plants to customers
  14. param sizes {CAPACITIES};
  15. param costs {CAPACITIES};
  16.  
  17. # Variables
  18. var shipped_mp {MINES, PLANTS} >= 0; # Table of amount shipped from each mine to each plant
  19. var shipped_pc {CUSTOMERS, PLANTS} >= 0; # Table of amount shipped from each plant to each cust
  20. var build {PLANTS, CAPACITIES} binary; # Binary,{0,1}
  21.  
  22. # Objective
  23. minimize TotalCost :
  24. sum {i in PLANTS, j in CAPACITIES} build[i,j] * costs[j] +
  25. sum{i in MINES, j in PLANTS} tp_mines_plants[i,j] * shipped_mp[i,j] +
  26. sum{i in CUSTOMERS, j in PLANTS} tp_plants_custs[i,j] * shipped_pc[i,j];
  27.  
  28. ################## Constraints
  29.  
  30. # Constraint on flow leaving mines
  31. subject to flowLeavingMines {i in MINES} :
  32. sum {j in PLANTS} shipped_mp[i,j] <= supply[i];
  33.  
  34. # Constraint on flows entering demand
  35. subject to flowEnteringCusts {i in CUSTOMERS} :
  36. sum {j in PLANTS} shipped_pc[i,j] >= demand[i];
  37.  
  38. # Constraint on flow entering plants
  39. subject to flowsEnteringPlants {i in PLANTS} :
  40. sum {j in MINES} shipped_mp[j,i] / 1.3
  41. <= sum {k in CAPACITIES} sizes[k] * build[i,k];
  42.  
  43. # Constraint on flow leaving plants
  44. subject to flowsLeavingPlants {i in PLANTS} :
  45. sum {j in CUSTOMERS} shipped_pc[j,i]
  46. <= sum {k in CAPACITIES} sizes[k] * build[i,k];
  47.  
  48. # Constraint for conservation of flow
  49. subject to flowConservation {i in PLANTS} :
  50. sum {j in MINES} shipped_mp[j,i] / 1.3
  51. = sum {k in CUSTOMERS} shipped_pc[k,i];
  52.  
  53. # Constraint on number of plants at a location
  54. subject to plantsAtLocation {i in PLANTS} :
  55. sum {j in CAPACITIES} build[i,j] <= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement