* GAMS reservoir yield example * March 31, 2002 $offlisting $offsymxref $offsymlist option limrow=0 limcol=0 ; sets i index for parameter analysis / 1*450 / 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 26 7 65 8 109 9 148 10 194 11 220 12 233 / ; scalar vmax maximum reservoir capacity /2000/ ; 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 /yield.res/ ; put results ; results.nd = 4 ; loop(i, vmax = (ord(i)-1)*1 ; put @4, vmax ; solve reservoir using lp maximizing y ; put @5, vmax, @15, y.l, par.m / ; ) ; putclose results ;