最近用gams编写了一段网络运输问题的程序,虽然程序没有编译错误,可程序运输的结果错误,请求高手指点。模型的代码如下:
c set of all cells
/c1 * c14/
cp set of all cells
/c1 * c14/
cr(c) set of source cells
/c1,c5,c9/
cs(c) set of sink cells
/c14/
ch(c) set of common cells
/c1 * c13/
t sets of discrete time intervals
/0 * 10 /
tfirst(t) intial time(t=0)
/0/
tend(t) t=8
/10/
AI(cp,c) relationship from cp to c
/c1.c2
c2.c3
c2.c6
c3.c4
c4.c14
c5.c6
c6.c7
c6.c10
c7.c8
c7.c12
c7.c13
c8.c14
c9.c10
c10.c11
c11.c14
c12.c4
c13.c11/ ;
time.. z =e= sum((ch,t),x(ch,t));
xx(c,t+1).. x(c,t+1) =e= x(c,t)+sum(cp$AI(cp,c),yi(cp,c,t))-sum(cp$AO(c,cp),yo(c,cp,t))+d(c,t);
xfirst(c,tfirst).. x(c,tfirst)=e=0;
yofirst(c,cp,tfirst).. yo(c,cp,tfirst)=e=0;
yifirst(cp,c,tfirst).. yi(cp,c,tfirst)=e=0 ;
qi(c,t).. sum(cp$AI(cp,c),yi(cp,c,t))=l=q(c,t);
qo(c,t).. sum(cp$AO(c,cp),yo(c,cp,t))=l=q(c,t);
nn(c,t).. sum(cp$AI(cp,c),yi(cp,c,t))+x(c,t)=l= n(c,t);
yx(c,t).. sum(cp$AO(c,cp),yo(c,cp,t))=l= x(c,t);
xend(ch,tend).. x(ch,tend)=e=0;
display x.l
AI为网络连接矩阵表达,AO与AI相同,只为方便表达约束条件中的输出流量。
程序的运行结果为:
1 2 3
c1 27.000 15.000 3.000
c5 15.000 3.000
c9 32.000 20.000 8.000
但恳请 高手帮忙指点 此模型的错误之处 多谢