# Set of crops; set C; # Set of scenarios set S; # Set of fields set F; param p{S}; # Number of acres of crop c to plant var x{C} >= 0; # Tons of crop c sold at most favorable price var w{C,S} >= 0; # Tons of crop c sold at unfavorable price var e{C,S} >= 0; # Tons of crop c purchased var y{C,S} >= 0; # Indicator on whether we plant crop c in field f. var z{C,F} binary; param Yield{C,S}; param PlantingCost{C}; param SalePrice{C}; # This is the *favorable* sales price param MaxAtGoodPrice{C} default Infinity; param LowSalePrice{C} default 0; param PurchasePrice{C} default 10000; param MinReq{C} default 0; param TotalAcres; param Area{F}; maximize Profit: sum{c in C, s in S} p[s] * SalePrice[c] * w[c,s] + sum{c in C, s in S} p[s] * LowSalePrice[c] * e[c,s] - sum{c in C} PlantingCost[c] * x[c] - sum{c in C, s in S} p[s] * PurchasePrice[c] * y[c,s]; subject to Land: sum{c in C} x[c] <= TotalAcres; subject to Zdef{c in C}: x[c] = sum{f in F} Area[f] * z[c,f]; subject to Onlyone{f in F}: sum{c in C} z[c,f] <= 1; subject to YieldDef{c in C, s in S}: Yield[c,s] * x[c] + y[c,s] - w[c,s] - e[c,s] - MinReq[c] = 0; subject to QuotaRestrict{c in C, s in S}: w[c,s] <= MaxAtGoodPrice[c];