lingo中for的用法,说我下标越界,就是那个a的值有问题,可就是找不出来
model:sets:gong/1..8/;shou/1..8/;xunhuan/1,2,3/:a;links(gong,shou):x,m;endsetsmax=x(1...
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 展开
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 展开
1个回答
展开全部
说清楚你要做的东西 我只能给你改成这样 是不是跟你的题目符合没法知道
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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询