MODEL:
SETS:
time/T1..T4/:p,Revenue,x,y,Xn,xr,yn,yr,a,c,s,zn,N,b,fail,faip,Xnleiji,Ynleiji,prl,prp,Omega,pll,ppl,plp,ppp,Prna,Pra,Rl,Rp,U,Plna,Pla,Ppna,Ppa,k,yita,rll,ul,rpl,up;
ENDSETS
DATA:
ENDDATA
!目标函数 ;
MAX=@SUM(time(I):Revenue(I));
@FOR(time(I):@GIN(P(I)));
@FOR(time(I):Revenue(I)=x(I)*P(I)/((1+Delta)^(i-1)));
@FOR(time(I):x(I)=xn(I)+xr(I));
@FOR(time(I):y(I)=yn(I)+yr(I));
@for(time(I):a(I)=c-s*P(I));
@FOR(time(I):zn(I)=(a(I)+(b*(fail*x(i-1)+faip*y(i-1))/N(I)))*(N(I)-Xnleiji(I-1)-Ynleiji(I-1)));
@for(time(I):@sum(time(i):xn(i))=Xnleiji(I));
@for(time(I):@sum(time(i):yn(i))=ynleiji(I));
@FOR(time(I):Xn(I)=Zn(I)*Prl(I));
@FOR(time(I):Yn(I)=Zn(I)*Prp(I));
@FOR(time(I):Xr(I)=pll(I)*x(I-1)+Omega*ppl(I)*y(I-1));
@FOR(time(I):Yr(I)=Omega*plp(I)*x(I-1)+ppp(I)*y(I-1));
@FOR(time(I):Prna(I)=@PPS(Rl(I),0));
@FOR(time(I):Pra(I)=1-Prna(I));
@FOR(time(I):U(I)=@if((Rl(I)-P(I))#LE#0,0,1));
@FOR(time(I):Prl(I)=Pra(I)*(Rl(I)-P(I))*U(I)/(Rl(I)+Rp(I)-P(I)));
@FOR(time(I):Prp(I)=Pra(I)*(Rp(I))/(Rp(I)+U(I)*(Rl(I)-P(I))));
! 当k<1时,k=yita*k : k=@if(k#lt#1,yita*k,k));
@FOR(time(I):Plna(I)=@PPS((k*rl(I-1)),0));
!@FOR(time(I):Rl1(I)=k*rl(I-1));
@FOR(time(I):Pla(I)=1-Plna(I));
@FOR(time(I):Ul(I)=@if((k*rl(I-1)-P(I))#LE#0,0,1));
@FOR(time(I):Pll(I)=Pla(I)*(k*rl(I-1)-P(I))*Ul(I)/(k*rl(I-1)+Rp(I)-P(I)));
@FOR(time(I):Plp(I)=Pla(I)*(Rp(I))/(Rp(I)+Ul(I)*(k*rl(I-1)-P(I))));
@FOR(time(I):Ppna(I)=@PPS((k*rp(I-1)),0));
!@FOR(time(I):Rp1(I)=k*rp(I-1));
@FOR(time(I):Ppa(I)=1-Ppna(I));
@FOR(time(I):Up(I)=@if((Rl(I)-P(I))#LE#0,0,1));
@FOR(time(I):Ppl(I)=Ppa(I)*(Rl(I)-P(I))*Up(I)/(Rl(I)+(k*rp(I-1))-P(I)));
@FOR(time(I):Ppp(I)=Ppa(I)*((k*rp(I-1)))/(k*rp(I-1)+Up(I)*(Rl(I)-P(I))));
end
就是我不能写循环咯?
追答哪有循环? lingo主模型里面的肯定都是约束 不是赋值
追问就是说当期(I时期)的结果是基于前一时期(I-1时期)的,我不能写I-1吗
追答当然可以写 但是不是赋值 是约束而已
追问比如这句 应该怎么改呢 @FOR(time(I):Yr(I)=Omega*plp(I)*x(I-1)+ppp(I)*y(I-1));
追答我写的第一句不是很清楚吗 你后面加个限制I大于1就完了
追问好的 谢啦 我可以加你qq吗 还有好多问题。。。
追答那百度hi找我
本回答被提问者采纳请教关于lingo软件的问题:1关于(I)和(I-1)怎么处理, 2,当k<1时,k=y...
第一个 @FOR(time(I)|I#gt#1:Plna(I)=@PPS((k*rl(I-1)),0));第二个肯定不能那样写 lingo不是程序性的语言 你自己把最终应该的结果算出来才行