* GAMS formulation for 1.731 Problem Set #3: Reservoir Yield * 10 Oct 2006 $offlisting $offsymxref $offsymlist option limrow=0 limcol=0 ; sets i index for parameter analysis / 1*90 / t time in months / 1*12 / ; parameters in(t) monthly inflow in million cubic meters / 1 259 2 143 3 91 4 57 5 47 6 46 7 65 8 109 9 148 10 194 11 220 12 233 / ; scalar vmax maximum reservoir capacity /20/ ; variables y assured yield in million cubic meters s(t) monthly storage in million cubic meters r(t) monthly release in million cubic meters v reservoir capacity in million cubic meters ; positive variables s r v ; equations maxcap 'capacity constraint' stateeq 'mass balance for reservoir' par 'parametric constraint' ; maxcap(t).. s(t) =L= v ; stateeq(t).. y - s(t) + s(t++1) + r(t) =E= in(t) ; par.. v =L= vmax ; model reservoir /all/ ; file results /PS06_32.res/ ; put results ; results.nd = 4 ; loop(i, vmax = (ord(i)-1)*5 ; solve reservoir using lp maximizing y ; put @5, vmax, @15, y.l, par.m / ; ) ; putclose results ;