set VEG; # VEG 1 and VEG 2 set OIL; # OIL 1, OIL 2, OIL 3 set RAW := VEG union OIL; # all five raw oils param SELL_PRICE >= 0; # price of final product param T > 0; # number of months in the model param HARDNESS {j in RAW} >= 1, <= 20; # a property of the raw oils param HARD_LOW >=0; param HARD_HIGH >=0; # the lower and upper bounds on the value of the # hardness of the final product param INV_COST >=0, <= 100; # cost of storing one ton for one month param COST {j in RAW, m in 1..T} >= 50, <= 200; # cost on futures market of purchasing # one ton of raw oil in a given month param STORE_LIMIT >=0 ; # limit on inventory of any # one oil. param INIT_INV; # the initial inventory # (same for each raw material) param FINAL_INV; # the final inventory # (same for each raw material) param Ref_Veg_limit >= 0; # limit on amount of vegetable # oil to be refined in one month param Ref_Oil_limit >= 0; # limit on amount of non-vegetable # oil to be refined in one month var BUY {j in RAW, m in 1..T} >= 0; # amount bought of each oil each month var USE {j in RAW, m in 1..T} >= 0; # amount blended of each oil each month var STORE {j in RAW, m in 1..T} >= 0, <= STORE_LIMIT; # amount stored of each oil each month var MAKE {m in 1..T} >= 0; # amount of final product made each month maximize profit: sum{m in 1..T} ( SELL_PRICE * MAKE[m] - sum{j in RAW} COST[j,m] * BUY[j,m] - INV_COST * ( sum{k in RAW} STORE[k,m])); # maximize revenue - purchase cost # - storage cost subject to Produce {m in 1..T}: MAKE[m] = sum{j in RAW} USE[j,m]; # The amount of final product is the sum of # the amount of raw materials used. subject to Final_hardness_lower {m in 1..T}: HARD_LOW*MAKE[m] <= sum{j in RAW} HARDNESS[j]*USE[j,m]; subject to Final_hardness_upper {m in 1..T}: HARD_HIGH*MAKE[m] >= sum{j in RAW} HARDNESS[j]*USE[j,m]; # The hardness of the final product is # the linear combination of the hardnesses # of the raw materials. subject to Refine_Veg {m in 1..T}: sum{j in VEG} USE[j,m] <= Ref_Veg_limit; # Production lines can only handle so # much vegetable oil subject to Refine_Oil {m in 1..T}: sum{j in OIL} USE[j,m] <= Ref_Oil_limit; # Production lines can only handle so # much non-vegetable oil subject to Inventory {j in RAW, m in 2..T}: STORE[j,m] = STORE[j,m-1] + BUY[j,m] - USE[j,m]; # relate the inventory at the end # of month m to the inventory at # the end of the previous month # and the amount bought and used subject to Inventory0 {j in RAW}: STORE[j,1] = INIT_INV + BUY[j,1] - USE[j,1]; # need to determine the inventory # at the end of Month 1 subject to Inventory_end {j in RAW}: STORE[j,6] = FINAL_INV; # need to have a certain amount on # hand at the end