lingo程序错在哪里?如何改?
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/08/19 12:39:34
lingo程序错在哪里?如何改?
model:
sets:
yj/1..7/:z;
yi/1..6/:;
yk/1..5/:;
sl1(yi,yj):x,d,s,k;
sl2(yj,yk):a;
sl3(yi,yk):b;
endsets
data:
z=100 60 80 40 110 90 30;
a=0.5 0.1 0.2 0.05 0
0.7 0.2 0 0.03 0
0 0 0.8 0 0.01
0 0.3 0 0.07 0
0.3 0 0 0.1 0.05
0.2 0.6 0 0 0
0.5 0 0.6 0.08 0.05;
b=3 2 3 1 1
4 2 2 1 1
4 2 3 0 1
4 1 3 1 1
3 2 3 1 1
4 2 2 1 0;
d=
500 1000 300 300 800 100 600
500 200 0 400 300 200 150
300 200 600 300 0 400 0
500 500 200 400 0 100 100
0 60 300 500 1000 1100 100
300 500 100 100 500 0 500;
enddata
max=@sum(sl1(i,j):z(j)*s(i,j)+5*k(i,j));
@for(yi(i):@for(yk(k):@sum(sl2(j):a(j,k)*x(i,j)=0);
end
model:
sets:
yj/1..7/:z;
yi/1..6/:;
yk/1..5/:;
sl1(yi,yj):x,d,s,k;
sl2(yj,yk):a;
sl3(yi,yk):b;
endsets
data:
z=100 60 80 40 110 90 30;
a=0.5 0.1 0.2 0.05 0
0.7 0.2 0 0.03 0
0 0 0.8 0 0.01
0 0.3 0 0.07 0
0.3 0 0 0.1 0.05
0.2 0.6 0 0 0
0.5 0 0.6 0.08 0.05;
b=3 2 3 1 1
4 2 2 1 1
4 2 3 0 1
4 1 3 1 1
3 2 3 1 1
4 2 2 1 0;
d=
500 1000 300 300 800 100 600
500 200 0 400 300 200 150
300 200 600 300 0 400 0
500 500 200 400 0 100 100
0 60 300 500 1000 1100 100
300 500 100 100 500 0 500;
enddata
max=@sum(sl1(i,j):z(j)*s(i,j)+5*k(i,j));
@for(yi(i):@for(yk(k):@sum(sl2(j):a(j,k)*x(i,j)=0);
end
![lingo程序错在哪里?如何改?](/uploads/image/z/3822933-21-3.jpg?t=lingo%E7%A8%8B%E5%BA%8F%E9%94%99%E5%9C%A8%E5%93%AA%E9%87%8C%3F%E5%A6%82%E4%BD%95%E6%94%B9%3F)
这样改语法就没问题了
model:
sets:
yj/1..7/:z;
yi/1..6/:;
yk/1..5/:;
sl1(yi,yj):x,d,s,k;
sl2(yj,yk):a;
sl3(yi,yk):b;
endsets
data:
z=100 60 80 40 110 90 30;
a=0.5 0.1 0.2 0.05 0
0.7 0.2 0 0.03 0
0 0 0.8 0 0.01
0 0.3 0 0.07 0
0.3 0 0 0.1 0.05
0.2 0.6 0 0 0
0.5 0 0.6 0.08 0.05;
b=3 2 3 1 1
4 2 2 1 1
4 2 3 0 1
4 1 3 1 1
3 2 3 1 1
4 2 2 1 0;
d=
500 1000 300 300 800 100 600
500 200 0 400 300 200 150
300 200 600 300 0 400 0
500 500 200 400 0 100 100
0 60 300 500 1000 1100 100
300 500 100 100 500 0 500;
enddata
max=@sum(sl1(i,j):z(j)*s(i,j)+5*k(i,j));
@for(yi(i):@for(yk(l):@sum(yj(j):a(j,l)*x(i,j))=0);
end
再问: 谢谢你,但为什么我运行的时候,还是报错,运行结果明显不对,这是我表达式逻辑的错误吗?
model:
sets:
yj/1..7/:z;
yi/1..6/:;
yk/1..5/:;
sl1(yi,yj):x,d,s,k;
sl2(yj,yk):a;
sl3(yi,yk):b;
endsets
data:
z=100 60 80 40 110 90 30;
a=0.5 0.1 0.2 0.05 0
0.7 0.2 0 0.03 0
0 0 0.8 0 0.01
0 0.3 0 0.07 0
0.3 0 0 0.1 0.05
0.2 0.6 0 0 0
0.5 0 0.6 0.08 0.05;
b=3 2 3 1 1
4 2 2 1 1
4 2 3 0 1
4 1 3 1 1
3 2 3 1 1
4 2 2 1 0;
d=
500 1000 300 300 800 100 600
500 200 0 400 300 200 150
300 200 600 300 0 400 0
500 500 200 400 0 100 100
0 60 300 500 1000 1100 100
300 500 100 100 500 0 500;
enddata
max=@sum(sl1(i,j):z(j)*s(i,j)+5*k(i,j));
@for(yi(i):@for(yk(l):@sum(yj(j):a(j,l)*x(i,j))=0);
end
再问: 谢谢你,但为什么我运行的时候,还是报错,运行结果明显不对,这是我表达式逻辑的错误吗?