有没有大佬帮看看这个程序?lingo 语法有错误
model:!i、j代表1-16种原料k代表第几个窑;sets:E/1..16/:ycl;!原材料的总重量;B/1..9/:low,high;!上下限;C(E,E):a;...
model:!i、j代表1-16种原料
k代表第几个窑;
sets:
E/1..16/:ycl;!原材料的总重量;
B/1..9/:low,high;!上下限;
C(E,E):a;!ij类型;
D(E,B):m,x,y;!jk\ik类型,m是第i种材料在第k窑中的重量;
endsets
data:
ycl=300 500 200 500 300 400 300 300 400 600 100 600 500 400 300 300;
high=600 600 600 900 900 900 1200 1200 1200;
low= 300 300 300 600 600 600 900 900 900;
a=
10 5 0 0 3 2 3 0 0 0 0 0 0 0 0 1
5 10 5 1 5 0 0 0 0 0 0 0 0 0 0 0
0 5 10 5 4 0 0 0 0 0 0 0 0 0 0 0
0 1 5 10 4 0 0 0 0 3 0 0 0 0 3 0
3 5 4 4 10 2 0 0 0 2 0 0 0 0 0 0
2 0 0 0 2 10 6 3 0 2 0 0 0 0 0 0
3 0 0 0 0 6 10 5 2 0 0 0 0 0 0 0
0 0 0 0 0 3 5 10 4 2 1 0 0 0 0 0
0 0 0 0 0 0 2 4 10 0 1 1 0 0 0 3
0 0 0 3 2 2 0 2 0 10 2 0 2 0 3 0
0 0 0 0 0 0 0 1 1 2 10 5 3 4 0 0
0 0 0 0 0 0 0 0 1 0 5 10 1 6 0 3
0 0 0 0 0 0 0 0 0 2 3 1 10 5 4 1
0 0 0 0 0 0 0 0 0 0 4 6 5 10 0 2
0 0 0 3 0 0 0 0 0 3 0 0 4 0 10 3
1 0 0 0 0 0 0 0 3 0 0 3 1 2 3 10;
enddata
@for(D:@bin(x));
@for(D:@bin(y)); !约束x、y为0-1变换 xik,yik 第i个原料放在第k个窑中是否需要;
@for(E(i):@sum(B(k):m(i,k)*x(i,k))=ycl(i));!原材料重量;
@for(B(k):@sum(E(i):x(i,k))>@if(m(i,k)#LT#500,1,0));!如果重量小于500,就有两个以上;
@for(B(k):@sum(E(i):m(i,k)*x(i,k))<=high(k));
@for(B(k):@sum(E(i):m(i,k)*x(i,k))>=low(k));!上下限;
max=@sum(B(k):@sum(C(i,j)|i#LT#j:a(i,j)*x(i,k)*x(j,k)/16));
x(j,k)=@if(a(i,j)#EQ#0,0,1);!如果没有亲缘则后面那个材料的y(j,k)=0;
end 展开
k代表第几个窑;
sets:
E/1..16/:ycl;!原材料的总重量;
B/1..9/:low,high;!上下限;
C(E,E):a;!ij类型;
D(E,B):m,x,y;!jk\ik类型,m是第i种材料在第k窑中的重量;
endsets
data:
ycl=300 500 200 500 300 400 300 300 400 600 100 600 500 400 300 300;
high=600 600 600 900 900 900 1200 1200 1200;
low= 300 300 300 600 600 600 900 900 900;
a=
10 5 0 0 3 2 3 0 0 0 0 0 0 0 0 1
5 10 5 1 5 0 0 0 0 0 0 0 0 0 0 0
0 5 10 5 4 0 0 0 0 0 0 0 0 0 0 0
0 1 5 10 4 0 0 0 0 3 0 0 0 0 3 0
3 5 4 4 10 2 0 0 0 2 0 0 0 0 0 0
2 0 0 0 2 10 6 3 0 2 0 0 0 0 0 0
3 0 0 0 0 6 10 5 2 0 0 0 0 0 0 0
0 0 0 0 0 3 5 10 4 2 1 0 0 0 0 0
0 0 0 0 0 0 2 4 10 0 1 1 0 0 0 3
0 0 0 3 2 2 0 2 0 10 2 0 2 0 3 0
0 0 0 0 0 0 0 1 1 2 10 5 3 4 0 0
0 0 0 0 0 0 0 0 1 0 5 10 1 6 0 3
0 0 0 0 0 0 0 0 0 2 3 1 10 5 4 1
0 0 0 0 0 0 0 0 0 0 4 6 5 10 0 2
0 0 0 3 0 0 0 0 0 3 0 0 4 0 10 3
1 0 0 0 0 0 0 0 3 0 0 3 1 2 3 10;
enddata
@for(D:@bin(x));
@for(D:@bin(y)); !约束x、y为0-1变换 xik,yik 第i个原料放在第k个窑中是否需要;
@for(E(i):@sum(B(k):m(i,k)*x(i,k))=ycl(i));!原材料重量;
@for(B(k):@sum(E(i):x(i,k))>@if(m(i,k)#LT#500,1,0));!如果重量小于500,就有两个以上;
@for(B(k):@sum(E(i):m(i,k)*x(i,k))<=high(k));
@for(B(k):@sum(E(i):m(i,k)*x(i,k))>=low(k));!上下限;
max=@sum(B(k):@sum(C(i,j)|i#LT#j:a(i,j)*x(i,k)*x(j,k)/16));
x(j,k)=@if(a(i,j)#EQ#0,0,1);!如果没有亲缘则后面那个材料的y(j,k)=0;
end 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询