set LOCATIONS; param interest_rate >= 0; param Gamma >= 0; param gamma >= 0; param lambda >= 0; param Lambda >= 0; param rho >= 0; set PROD_TIMES = 1 .. (Gamma*gamma/lambda); set PROC_TIMES = 1 .. (Gamma*gamma); param cotton_price{LOCATIONS, PROC_TIMES} >= 0; param existing_cotton{LOCATIONS, PROC_TIMES} >= 0; param workload{PROD_TIMES} >= 0; param avail_machines{LOCATIONS} integer >= 0; param idle_cotton >=0; param peak_cotton >= 0; param une >= 0; param epsilon; param tyr >= 0; param r >=0; var Machines{i in LOCATIONS, PROD_TIMES} integer >=0 , <= avail_machines[i]; var Buy_Cotton{LOCATIONS, PROC_TIMES, PROC_TIMES} >= 0; var Ut{ i in LOCATIONS, j in PROD_TIMES} = Machines[i,j]/(sum{k in LOCATIONS}Machines[k,j]*avail_machines[i]); var temp_Required_Cotton {i in LOCATIONS, j in PROD_TIMES} = Machines[i, j] *(idle_cotton + (une-1)*peak_cotton) + Machines[i, j] *(peak_cotton - idle_cotton)*(Ut[i,j]) - epsilon; var Required_Cotton{i in LOCATIONS, j in PROC_TIMES} = sum {k in j*gamma/lambda .. (j+1)*gamma/lambda-1} temp_Required_Cotton[i, k]; var Sell_Cotton{LOCATIONS, PROC_TIMES, PROC_TIMES} >= 0; minimize Cost: sum{i in LOCATIONS, j in PROC_TIMES, k in PROC_TIMES} (Buy_Cotton[i, j, k] - Sell_Cotton[i, j, k])*cotton_price[i, k]*exp((j-k)*interest_rate/tyr); ; subject to Workload {i in PROC_TIMES}: workload[i] <= sum {j in LOCATIONS} Machines[j, i]; subject to Cant_Buy_Past { i in LOCATIONS, j in PROC_TIMES, k in 1 .. j-1}: Buy_Cotton[i, j, k] = 0; subject to Cant_Sell_Past { i in LOCATIONS, j in PROC_TIMES, k in 1 .. j-1}: Sell_Cotton[i,j,k] = 0; subject to Enough_Cotton { i in LOCATIONS, j in PROC_TIMES}: Required_Cotton[i, j] <= sum{l in 1 .. j} (Buy_Cotton[i, l, j]) + existing_cotton[i,j]; subject to Cant_Outsell { i in LOCATIONS, j in PROC_TIMES, k in PROC_TIMES}: sum{l in 1 .. j-1} (Buy_Cotton[i, l, k] - Sell_Cotton[i, l, k] + existing_cotton[i, k]) >= Sell_Cotton[i, j, k];