Nerviie

Untitled

Mar 19th, 2024
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. ```
  2. set CRUDE; # raw materials
  3. set INTERM; # intermediate products
  4. set GAS; # final products
  5.  
  6. param advertising_demand; # barrels gas/$
  7. param unit_dist_cost; # $/barrels produced
  8. param unit_blend_cost; # $/barrels produced
  9. param unit_crack_cost; # $/barrels produced
  10. param destil_capacity; # number barrels distilled
  11. param crack_capacity; # number barrels cracked
  12.  
  13. param sales_price{GAS};
  14. param gas_octane{GAS};
  15. param demand{GAS};
  16.  
  17. param d{CRUDE,INTERM}; # conversion factor at distillery
  18. param c{INTERM,INTERM}; # conversion factor at cracking
  19. param purchase_quant{CRUDE}; # barrels
  20. param purchase_price{CRUDE};
  21. param interm_octane{INTERM};
  22.  
  23. var z{k in CRUDE} >= 0; # barrels of crude k to buy
  24. var y0{j in INTERM} >= 0; # barrels of intermediate product j to produce in distillation
  25. var y1{j in INTERM} >= 0; # barrels of intermediate product j to produce in cracking
  26. var y2{j in INTERM} >= 0; # barrels of intermediate product j to use in blending
  27. var v{i in GAS} >= 0; # barrels of gas i to produce
  28. var x{j in INTERM, i in GAS} >= 0; # barrels of intermediate j to use to produce gas i
  29. var a{i in GAS} >= 0; # amount spend on advertising gas i
  30. var revenue;
  31. var purchase_cost;
  32. var production_cost;
  33. var advertising_cost;
  34. var total_cost;
  35.  
  36. maximize profit: revenue - total_cost;
  37.  
  38. REV: revenue = sum {i in GAS} sales_price[i] * v[i];
  39. P: purchase_cost = sum {k in CRUDE} purchase_price[k] * z[k];
  40. ADV: advertising_cost = sum {i in GAS} a[i];
  41. PROD: production_cost = unit_dist_cost * sum {k in CRUDE} z[k] +
  42. unit_crack_cost * sum {j in INTERM} y1[j] +
  43. unit_blend_cost * sum {j in INTERM} y2[j];
  44. COST: total_cost = purchase_cost + advertising_cost + production_cost;
  45.  
  46. DEST_CAPACITY:
  47. sum {i in CRUDE} z[i] <= destil_capacity;
  48.  
  49. DEMAND {i in GAS}:
  50. v[i] = demand[i] + advertising_demand * a[i];
  51.  
  52. PROCUREMENT {k in CRUDE}:
  53. z[k] <= purchase_quant[k];
  54.  
  55. OCTANE {i in GAS}:
  56. sum {j in INTERM} interm_octane[j] * x[j,i] >= gas_octane[i] * v[i];
  57.  
  58. DISTIL {j in INTERM}:
  59. y0[j] = sum {k in CRUDE} d[k,j] * z[k];
  60.  
  61. BLEND {i in GAS}:
  62. v[i] = sum {j in INTERM} x[j,i];
  63.  
  64. BOM {j in INTERM}:
  65. y2[j] = sum {i in GAS} x[j,i];
  66.  
  67. CRACKING {j in INTERM}:
  68. y2[j] = y0[j] - y1[j] + sum {j_ in INTERM} c[j_,j] * y1[j_];
  69.  
  70. CRACK_CAPACITY:
  71. sum {j in INTERM} y1[j] <= crack_capacity;
  72. ```
Advertisement
Add Comment
Please, Sign In to add comment