# --------------------- # SETS # --------------------- set prd; # products set raw; # raw materials # --------------------- # PARAMETERS # --------------------- param T > 0 integer; # number of production periods param max_prd > 0; # maximum units of production per period param units {raw,prd} >= 0; # units[i,j] is the quantity of raw material i # needed to manufacture one unit of product j param init_stock {raw} >= 0; # init_stock[i] is the maximum initial stock # of raw material i param profit {prd,1..T}; # profit[j,t] is the estimated value (if >= 0) # or disposal cost (if <= 0) of # a unit of product j in period t param cost {raw} >= 0; # cost[i] is the storage cost # per unit per period of raw material i param value {raw}; # value[i] is the estimated residual value # (if >= 0) or disposal cost (if <= 0) # of raw material i after the last period # --------------------- # VARIABLES # --------------------- var Make {prd,1..T} >= 0; # Make[j,t] is the number of units of product j # manufactured in period t var Store {raw,1..T+1} >= 0; # Store[i,t] is the number of units of raw # material i in storage at the beginning # of period t # --------------------- # OBJECTIVE # --------------------- maximize total_profit: sum {t in 1..T} ( sum {j in prd} profit[j,t] * Make[j,t] - sum {i in raw} cost[i] * Store[i,t] ) + sum {i in raw} value[i] * Store[i,T+1]; # Total over all periods of estimated profit, # minus total over all periods of storage cost, # plus value of remaining raw materials after last period # --------------------- # CONSTRAINTS # --------------------- subject to limit {t in 1..T}: sum {j in prd} Make[j,t] <= max_prd; # Total production in each period must not exceed maximum subject to start {i in raw}: Store[i,1] <= init_stock[i]; # Units of each raw material in storage at beginning # of period 1 must not exceed initial stock subject to balance {i in raw, t in 1..T}: Store[i,t+1] = Store[i,t] - sum {j in prd} units[i,j] * Make[j,t]; # Units of each raw material in storage # at the beginning of any period t+1 must equal # units in storage at the beginning of period t, # less units used for production in period t