出现1017错误代码说明你用的lingo软件有问题,建议换个版本,我空间有下载地址。。。
另外程序有错,已改,如下。。。
model:
sets:
factory/p1..p6/:p;
warhouse/w1..w4/:a,f,g;
customer/c1..c6/:d;
tr/tr1..tr4/:z;
link1(factory,warhouse):c,w;
link2(warhouse,customer):h,x;
endsets
data:
p=40000 50000 60000 70000 60000 40000;
a=70000 60000 70000 50000;
f=500000 300000 400000 0;!f的数据少了一个;
g=3 2 5 4;
d=10000 20000 10000 20000 30000 10000;
c=6 5 4 2
2 3 4 9
6 8 7 5
7 4 2 3
4 2 5 1
3 4 1 7;
h=3 2 7 4 7 5
6 1 4 2 5 3
2 4 5 3 6 8
5 6 3 7 4 6;
enddata
min=@sum(link1(k,i):c(k,i)*w(k,i))+@sum(link2(i,j):h(i,j)*x(i,j))+@sum(link1(k,i):g(i)*w(k,i))+@sum(warhouse(i):f(i)*z(i));
@for(factory(k):
@sum(warhouse(j):w(k,j))<=p(k));!此句有错;
@for(warhouse(i):
@sum(link2(i,j):x(i,j))=@sum(link1(k,i):w(k,i)));
@for(customer(j):
@sum(link2(i,j):x(i,j))>=d(j));
@for(warhouse(i):
@sum(link1(k,i):w(k,i))<=(a(i)*z(i)));
@sum(tr(i):z(i))<=3;
@for(tr(i):@bin(z));
end