大家能帮忙看看这个lingo程序哪里有问题吗?新手很艰难啊,请大家简洁一点说,运行之后总是出现error code 24,说z1是invalid set namemodel:sets:error/1..4/:z1,z2;weight/1..4/:w;datas/1..4/:d1;link(datas,datas):dd,aa;ends
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 09:37:44
大家能帮忙看看这个lingo程序哪里有问题吗?新手很艰难啊,请大家简洁一点说,运行之后总是出现error code 24,说z1是invalid set namemodel:sets:error/1..4/:z1,z2;weight/1..4/:w;datas/1..4/:d1;link(datas,datas):dd,aa;ends
大家能帮忙看看这个lingo程序哪里有问题吗?
新手很艰难啊,请大家简洁一点说,运行之后总是出现error code 24,说z1是invalid set name
model:
sets:
error/1..4/:z1,z2;
weight/1..4/:w;
datas/1..4/:d1;
link(datas,datas):dd,aa;
endsets
data:
dd=1.1833,-0.9000,-0.3500,0.5400,
0.6108,0.1100,-0.2833,1.2767,
-1.5342,0.7060,0.8767,1.5433,
-0.2600,0.0840,-0.2433,-0.2733;
aa=-2,0.5,2,3,
2,-2,3.0000,4.0000,
0.5000,0.3333,-2.0000,2.0000,
0.3333,0.2500,0.5000,-2.0000;
enddata
min=0.5*r+0.5*e;
@for(z1(i):@sum(dd(i,j)*w(j))+r>0);
@for(z1(i):@sum(dd(i,j)*w(j))-r0);
@for(z2(i):@sum(aa(i,j)*w(j))-e
大家能帮忙看看这个lingo程序哪里有问题吗?新手很艰难啊,请大家简洁一点说,运行之后总是出现error code 24,说z1是invalid set namemodel:sets:error/1..4/:z1,z2;weight/1..4/:w;datas/1..4/:d1;link(datas,datas):dd,aa;ends
主要是集合和集合的实例用的不对;那个权重之和是1还是0?
修改了的程序可以跑
model:
sets:
error/1..4/:z1,z2;
weight/1..4/:w;
datas/1..4/:d1;
link(datas,datas):dd,aa;
endsets
data:
dd=1.1833,-0.9000,-0.3500,0.5400,
0.6108,0.1100,-0.2833,1.2767,
-1.5342,0.7060,0.8767,1.5433,
-0.2600,0.0840,-0.2433,-0.2733;
aa=-2,0.5,2,3,
2,-2,3.0000,4.0000,
0.5000,0.3333,-2.0000,2.0000,
0.3333,0.2500,0.5000,-2.0000;
enddata
min=0.5*r+0.5*e;
@for(error(i):@sum(link(i,j):dd(i,j)*w(j))+r>0);
@for(error(i):@sum(link(i,j):dd(i,j)*w(j))-r0);
@for(error(i):@sum(link(i,j):aa(i,j)*w(j))-e