$title Homework 5 Question 1, Fall 2000. option limrow=0, limcol=0; set region /A,B/ milkType /raw,hifat,lofat/ costfuncDefs /grad1, grad2, break/ productType /cream, milk/ table butterfat(region,milkType) raw hifat lofat A .05 .80 .01 B .035 .80 .005; table costfunc(region,costfuncDefs) grad1 grad2 break A .54 .58 500 B .44 .45 700; parameter separationCost(region) / A .05, B .06 / maxDemand(productType) / cream 300, milk 2000 / minRichness(productType) / cream .50, milk .02 / prices(productType) / cream 4.50, milk .80 /; variables purchase(region) purchaseOverBreakpoint(region) amtsAfterSeparation(region,milkType) amtsMixed(region,milkType,productType) amtProduct(productType), saleableProduct(ProductType), cost, sales, profit; positive variable purchase, purchaseOverBreakpoint, amtsAfterSeparation, amtsMixed, amtProduct, saleableProduct, cost, sales; equations fatConservationSeparation(region) fat conserved in separation volumeConservationSeparation(region) volume conserved in separation volumeMixed(region,milkType) mix at most what's available totalProduct(productType) volume of each final product qualityProduct(productType) min fat content of final product howMuchCanYouSell(productType) amt sold may be <= amt produced exceedBreakpoint(region) purchase exceeds price breakpnt? productionCost total cost of production revenue sales revenue objective; * ensure that the total amount of fat in the products of separation equals * the total fat in the raw milk purchased fatConservationSeparation(region).. purchase(region)*butterfat(region,"raw") =e= sum(milkType, amtsAfterSeparation(region,milkType) * butterfat(region,milkType)); * ensure that volume is conserved in separation volumeConservationSeparation(region).. purchase(region) =e= sum(milkType, amtsAfterSeparation(region,milkType)); * ensure that the amounts of separated product contributed to * final product satisfy a volume conservation constraint volumeMixed(region,milkType).. sum(productType, amtsMixed(region,milkType,productType)) =l= amtsAfterSeparation(region,milkType); * calculate the amount of each final product totalProduct(productType).. amtProduct(productType) =e= sum((region,milkType), amtsMixed(region,milkType,productType)); * ensure that each final product has the required content of fat qualityProduct(productType).. sum((region,milkType), butterfat(region,milkType) * amtsMixed(region,milkType,productType)) =g= minRichness(productType) * amtProduct(productType); * from the amounts produced, extract the (possibly smaller) amount * that can actually be sold. howMuchCanYouSell(productType).. saleableProduct(productType) =l= amtProduct(productType); * how much over the price breakpoint are we purchasing? exceedBreakpoint(region).. purchaseOverBreakpoint(region) =g= purchase(region) - costfunc(region,"break"); * production cost includes purchase cost and separation cost productionCost.. cost =e= sum(region, purchase(region)*costfunc(region,"grad1") + purchaseOverBreakpoint(region) * (costfunc(region,"grad2")-costfunc(region,"grad1"))) + sum(region, (amtsAfterSeparation(region,"hifat") + amtsAfterSeparation(region,"lofat")) * separationCost(region)); * calculate total sales revenue revenue.. sales =e= sum(productType, saleableProduct(productType) * prices(productType)); objective.. profit =e= sales - cost; model milky / all /; * set upper bound on sales saleableProduct.up(productType) = maxDemand(productType); solve milky using lp maximizing profit; display purchase.l, amtsAfterSeparation.l, amtProduct.l, profit.l;