lingo中for的用法,说我下标越界,就是那个a的值有问题,可就是找不出来model:sets:gong/1..8/;shou/1..8/;xunhuan/1,2,3/:a;links(gong,shou):x,m;endsetsmax=x(1,3)+x(2,4);@for(gong(I):@for(shou(J):@bnd(0,x(I,J),m(I,J))));@for(xunhuan(k
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/09 06:08:43
lingo中for的用法,说我下标越界,就是那个a的值有问题,可就是找不出来model:sets:gong/1..8/;shou/1..8/;xunhuan/1,2,3/:a;links(gong,shou):x,m;endsetsmax=x(1,3)+x(2,4);@for(gong(I):@for(shou(J):@bnd(0,x(I,J),m(I,J))));@for(xunhuan(k
lingo中for的用法,说我下标越界,就是那个a的值有问题,可就是找不出来
model:
sets:
gong/1..8/;
shou/1..8/;
xunhuan/1,2,3/:a;
links(gong,shou):x,m;
endsets
max=x(1,3)+x(2,4);
@for(gong(I):@for(shou(J):@bnd(0,x(I,J),m(I,J))));
@for(xunhuan(k)|a#ge#3#and#a#le#5:
@for(gong(I):x(I,a)=@sum(shou(J):x(a,J))));
data:
m=12 0 0 0 0 0 0 0
0 20 0 0 0 0 0 0
12 0 0 0 2 0 0 0
0 20 6 0 0 0 0 0
0 0 3 7 0 0 0 0
0 0 6 0 5 11 0 0
0 0 0 0 8 0 12 4
0 0 0 9 0 0 0 5 ;
a=3,4,5;
enddata
lingo中for的用法,说我下标越界,就是那个a的值有问题,可就是找不出来model:sets:gong/1..8/;shou/1..8/;xunhuan/1,2,3/:a;links(gong,shou):x,m;endsetsmax=x(1,3)+x(2,4);@for(gong(I):@for(shou(J):@bnd(0,x(I,J),m(I,J))));@for(xunhuan(k
说清楚你要做的东西 我只能给你改成这样 是不是跟你的题目符合没法知道
model:
sets:
gong/1..8/;
shou/1..8/;
links(gong,shou):x,m;
endsets
max=x(1,3)+x(2,4);
@for(gong(I):@for(shou(J):@bnd(0,x(I,J),m(I,J))));
@for(links(I,a)|a#ge#3 #and# a#le#5:x(I,a)=@sum(shou(J):x(a,J)));
data:
m=12 0 0 0 0 0 0 0
0 20 0 0 0 0 0 0
12 0 0 0 2 0 0 0
0 20 6 0 0 0 0 0
0 0 3 7 0 0 0 0
0 0 6 0 5 11 0 0
0 0 0 0 8 0 12 4
0 0 0 9 0 0 0 5 ;
enddata