# AMPL model file for the inventory model # (WV-IMP problem 1 from page 104: discussed in class) # # min z = 5 x1 + 8 x2 + 4 x3 + 7 x4 + 2 (s1+s2+s3) - 6 s4 (net cost) # # s.t. s1 = x1 - 50 (inventory month 1) # s2 = x2+s1 - 65 (inventory month 2) # s3 = x3+s2 - 100 (inventory month 3) # s4 = x4+s3 - 70 (inventory month 4) # all vars >= 0 (non-negativity) param n; # No. of months param Demand {i in 1..n}; # demand for each month param Cost {i in 1..n}; # production cost for each month param Store_Cost; # storage cost (same for each month) param Price; # selling price (at the end of month n) var x {j in 1..n} >= 0; # No. units made in month j var s {j in 0..n} >= 0; # inventory at the end of month j # s[0] - inventory at the start of month 1 = 0 minimize net_cost: sum {k in 1..n} Cost[k]*x[k] + Store_Cost*(sum{j in 0..n-1} s[j]) - Price*s[n]; subject to inventory_balance {i in 1..n}: s[i] = x[i] + s[i-1] - Demand[i]; subject to set_initial_inventory: s[0] = 0;