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/08/14 08:08:08
![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](/uploads/image/z/15223704-24-4.jpg?t=lingo%E4%B8%ADfor%E7%9A%84%E7%94%A8%E6%B3%95%2C%E8%AF%B4%E6%88%91%E4%B8%8B%E6%A0%87%E8%B6%8A%E7%95%8C%2C%E5%B0%B1%E6%98%AF%E9%82%A3%E4%B8%AAa%E7%9A%84%E5%80%BC%E6%9C%89%E9%97%AE%E9%A2%98%2C%E5%8F%AF%E5%B0%B1%E6%98%AF%E6%89%BE%E4%B8%8D%E5%87%BA%E6%9D%A5model%3Asets%3Agong%2F1..8%2F%3Bshou%2F1..8%2F%3Bxunhuan%2F1%2C2%2C3%2F%3Aa%3Blinks%28gong%2Cshou%29%3Ax%2Cm%3Bendsetsmax%3Dx%281%2C3%29%2Bx%282%2C4%29%3B%40for%28gong%28I%29%3A%40for%28shou%28J%29%3A%40bnd%280%2Cx%28I%2CJ%29%2Cm%28I%2CJ%29%29%29%29%3B%40for%28xunhuan%28k)
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