sets SR Supply reservoir /BLH,YNH/ U Users:Wazidian\Guangludao /WZD,GLD/ T Period of time /1*12/ ; parameters SC Storage coefficient /BLH 1.08, YNH 0.59/ FC Fixed cost: 10 thousand yuan per year /10000/ RC(SR) Running cost: yuan per m3 /BLH 0.15, YNH 0.314/ FDIV Fixed diversion per year from Dahuofang Reservior: 10 thousand m3 /10000/ DS Reservior dead storage: 10 thousand m3 /BLH 7000, YNH 2208/ ; parameters IN(SR,T) Inflow: 10 thousand m3; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=IN rng= INFLOW!B15:N17 rdim=1 cdim=1 $gdxin INPUT1.gdx $load IN $gdxin display IN ; parameters Vlower(SR,T); $call gdxxrw INPUT1.xls output = INPUT1.gdx par=Vlower rng= Vlower!B15:N17 rdim=1 cdim=1 $gdxin INPUT1.gdx $load Vlower $gdxin display Vlower ; parameters Vupper(SR,T); $call gdxxrw INPUT1.xls output = INPUT1.gdx par=Vupper rng= Vupper!B15:N17 rdim=1 cdim=1 $gdxin INPUT1.gdx $load Vupper $gdxin display Vupper ; parameters DLL1(T) Diversion limit line one; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=DLL1 rng= DLL1!B2:C13 rdim=1 $gdxin INPUT1.gdx $load DLL1 $gdxin display DLL1 ; parameters DLL2(T) Diversion limit line two; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=DLL2 rng= DLL2!B2:C13 rdim=1 $gdxin INPUT1.gdx $load DLL2 $gdxin display DLL2 ; parameters DLL3(T) Diversion limit line three; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=DLL3 rng= DLL3!B2:C13 rdim=1 $gdxin INPUT1.gdx $load DLL3 $gdxin display DLL3 ; parameters DLL4(T) Diversion limit line four; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=DLL4 rng= DLL4!B2:C13 rdim=1 $gdxin INPUT1.gdx $load DLL4 $gdxin display DLL4 ; parameters WD(U,T) Water demand: 10 thousand m3 per month; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=WD rng= DEMANDS!B15:N17 rdim=1 cdim=1 $gdxin INPUT1.gdx $load WD $gdxin display WD ; parameters L(SR,T) Loss; $call gdxxrw INPUT1.xls output = INPUT1.gdx par=L rng= LOSS!B15:N17 rdim=1 cdim=1 $gdxin INPUT1.gdx $load L $gdxin display L ; binary variables z1 z2 z3 z4 z5 ; free variables w1 w2 w3 w4 w5 w6 w7 ; variables obj Objective variable TDIV Total diversion DIVC Diversion cost of Dahuofang Reservoir ; positive variables S(SR,T) Reservoir storage a(T) Water supply coefficient of Biliuhe Reservoir b(T) Water supply coefficient of Yingnahe Reservoir WS(SR,U,T) Water supply DIV(T) Diversion from Dahuofang Reservoir SU(SR,T) Surplus water ; w1.lo=0; w1.up=1; w2.lo=0; w2.up=1; w3.lo=0; w3.up=1; w4.lo=0; w4.up=1; w5.lo=0; w5.up=1; w6.lo=0; w6.up=1; w7.lo=0; w7.up=1; a.lo(T)=0; a.up(T)=1; b.lo(T)=0; b.up(T)=1; S.l('BLH',T)=60000; S.l('YNH',T)=18000; S.lo('BLH',T)=7000; S.lo('YNH',T)=2208; S.up('BLH',T)=71400; S.up('YNH',T)=23104; equations SBLHfun DIVfun w1_con w2_con w3_con w4_con w5_con w6_con w7_con tw1_con tw2_con tz1_con tz2_con afun bfun TDIVfun1 TDIVfun2 DIVCfun objfun obj function WB_con1 water banlance constraint WB_con2 RS_con1 reservoir storage constraint RS_con2 RS_con3 RS_con4 RS_con5 RS_con6 WD_con1 water demand constraint WD_con2 WD_con3 WD_con4 DI_con1 diversion constraint DI_con2 WS_con1 water supply constraint WS_con2 WS_con3 WS_con4 WS_con5 WS_con6 ; SBLHfun(T).. S('BLH',T) =e= DLL1(T)*w1+DLL2(T)*w2+DLL3(T)*w3+DLL4(T)*w4; DIVfun(T).. DIV(T) =e= w2*2700*DLL2(T)/DLL3(T)+w3*2700+w4*2700; w1_con.. w1 =l= z1; w2_con.. w2 =l= z1+z2; w3_con.. w3 =l= z2+z3; w4_con.. w4 =l= z3; tw1_con.. w1+w2+w3+w4 =e= 1; tz1_con.. z1+z2+z3 =e= 1; TDIVfun1.. TDIV =e= SUM(T,DIV(T)); TDIVfun2.. TDIV =e= FDIV*w6+28800*w7; DIVCfun.. DIVC =e= 1.1*w6+1.1*w7; w5_con.. w5 =l= z4; w6_con.. w6 =l= z4+z5; w7_con.. w7 =l= z5; tw2_con.. w5+w6+w7 =e= 1; tz2_con.. z4+z5 =e= 1; objfun.. obj =e= FC+(TDIV-FDIV)*DIVC +sum(T,WS('BLH','WZD',T)+WS('BLH','GLD',T))*RC('BLH') +sum(T,WS('YNH','WZD',T)+WS('YNH','GLD',T))*RC('YNH'); WB_con1(T).. S('BLH',T+1) =e= S('BLH',T)+IN('BLH',T)+DIV(T)-WS('BLH','WZD',T)-WS('BLH','GLD',T)-L('BLH',T)-SU('BLH',T); WB_con2(T).. S('YNH',T+1) =e= S('YNH',T)+IN('YNH',T)-WS('YNH','WZD',T)-WS('YNH','GLD',T)-L('YNH',T)-SU('YNH',T); afun(T).. a(T) =e= (S('BLH',T)/Vupper('BLH',T))/(S('BLH',T)/Vupper('BLH',T)+S('YNH',T)/Vupper('YNH',T)); bfun(T).. b(T) =e= (S('YNH',T)/Vupper('YNH',T))/(S('BLH',T)/Vupper('BLH',T)+S('YNH',T)/Vupper('YNH',T)); RS_con1(SR,T).. S(SR,T) =g= Vlower(SR,T); RS_con2(SR,T).. S(SR,T) =l= Vupper(SR,T); RS_con3('BLH',T).. S('BLH',T) =g= Vlower('BLH',T); RS_con4('BLH',T).. S('BLH',T) =l= Vupper('BLH',T); RS_con5('YNH',T).. S('YNH',T) =g= Vlower('YNH',T); RS_con6('YNH',T).. S('YNH',T) =l= Vupper('YNH',T); WD_con1(T).. WS('BLH','WZD',T) =e= a(T)*WD('WZD',T); WD_con2(T).. WS('YNH','WZD',T) =e= b(T)*WD('WZD',T); WD_con3(T).. WS('BLH','GLD',T) =e= a(T)*WD('GLD',T); WD_con4(T).. WS('YNH','GLD',T) =e= b(T)*WD('GLD',T); DI_con1(T).. DIV(T)=l= 2700; DI_con2.. sum(T,DIV(T)) =l= 28800; WS_con1(T).. WS('BLH','WZD',T) =l= 3600; WS_con2(T).. WS('BLH','GLD',T) =l= 150; WS_con3(T).. WS('YNH','WZD',T) =l= 1980; WS_con4(T).. WS('YNH','GLD',T) =l= 150; WS_con5(T).. WS('BLH','WZD',T)+WS('BLH','GLD',T) =l= 64400; WS_con6(T).. WS('YNH','WZD',T)+WS('YNH','GLD',T) =l= 20896; model daliansimple1 /all/; solve daliansimple1 using MIQCP minimizing obj; display a.l,b.l,obj.l