sets types / TypeA, TypeB, TypeC, TypeD / month / Month1, Month2, Month3 / ; scalar shop / 28000 /; parameters PC(types) / TypeA 8000 TypeB 5000 TypeC 8000 TypeD 15000 / HOST(types) / TypeA 35 TypeB 39 TypeC 45 TypeD 85 / CLEAN(types) / TypeA 500000 TypeB 900000 TypeC 800000 TypeD 900000 / ; table D(types,month) Month1 Month2 Month3 TypeA 5000 6000 3000 TypeB 900 1000 4000 TypeC 6000 9000 4000 TypeD 10000 11000 14000 ; variables money get(types,month) after_i(types) after_ii(types) after_n_i(types) after_n_ii(types) process(types,month) use(types,month); ; positive variable get(types,month), process(types,month), after_i(types), after_ii(types), after_n_i(types), after_n_ii(types), process(types,month); integer variable use(types,month); equations money_first money_third PC_limit(types,month) shop_limit(month) processing_i(types) processing_ii(types) processing_iii(types) a_i(types) a_ii(types) an_i(types) an_ii(types) d_i(types) d_ii(types) d_iii(types) proc_mip(types,month) use_limit(types,month) ; money_first .. money =E= sum(types, (after_n_i(types)+after_n_ii(types))*HOST(types) + (after_i(types)+after_ii(types))*(HOST(types)+4)); money_third .. money =E= sum(types, (after_n_i(types)+after_n_ii(types))*HOST(types) + (after_i(types)+after_ii(types))*(HOST(types)+4)) + sum(types, sum(month, use(types,month)*CLEAN(types))); PC_limit(types,month) .. get(types,month) =L= PC(types); shop_limit(month) .. sum(types, process(types,month)) =L= shop; processing_i(types) .. process(types,'Month1') =L= (get(types,'Month1') ); processing_ii(types) .. process(types,'Month2') =L= (get(types,'Month2') + after_n_i(types) ); processing_iii(types) .. process(types,'Month3') =L= (get(types,'Month3') + after_n_ii(types)); proc_mip(types,month) .. process(types,month) =L= use(types,month)*shop; an_i(types) .. after_n_i(types) =E= get(types,'Month1') - process(types,'Month1'); an_ii(types) .. after_n_ii(types) =E= get(types,'Month2') + after_n_i(types) - process(types,'Month2'); a_i(types) .. after_i(types) =E= process(types,'Month1') - D(types,'Month1'); a_ii(types) .. after_ii(types) =E= process(types,'Month2') + after_i(types) - D(types,'Month2'); d_i(types) .. process(types,'Month1') =G= D(types,'Month1'); d_ii(types) .. after_i(types) + process(types,'Month2') =G= D(types,'Month2'); d_iii(types) .. after_ii(types) + process(types,'Month3') =G= D(types,'Month3'); use_limit(types,month) .. use(types,month) =L= 1; model problem /money_third, PC_limit, shop_limit, a_i, a_ii, an_i, an_ii, d_i, d_ii, d_iii, processing_i, processing_ii, processing_iii, proc_mip, use_limit/; problem.optcr = 0.0; solve problem using mip minimizing money; display money.l;