starbinbin 发表于 2010-4-23 13:53

lingo的高手麻烦请进!!!

本帖最后由 starbinbin 于 2010-4-23 13:54 编辑

以下的代码到底哪里有错啊???
model:
sets:
students/s1..s8/;
pairs(students,students)|&2#gt#&1:
benefit,match;
endsets
data:
benefit=
9 3 4 2 1 5 6
1 7 3 5 2 1
4 4 2 9 2
1 5 5 2
8 7 6
2 3
4;
enddata
max=@sum(pairs(i,j):benefit(i,j)*match(i,j));
@for(students(i):
@sum(pairs(j,k)|j#eq#i#or#k#eq#i:match(j,k))=1);
@for(pairs(i,j)bin(match(i,j)));
end

olh2008 发表于 2010-4-23 14:15

有几个地方写的有点问题,在我改的代码里给了说明。
我改过之后就能运行了,最优目标值为30。
model:
sets:
students/s1..s8/;
pairs(students,students)|&2 #gt# &1:benefit,match;
endsets
data:
benefit=
9 3 4 2 1 5 6
1 7 3 5 2 1
4 4 2 9 2
1 5 5 2
8 7 6
2 3
4; !分号要英文状态下的;
enddata
max=@sum(pairs(i,j):benefit(i,j)*match(i,j));
@for(students(i):
@sum(pairs(j,k)|j #eq# i #or# k #eq# i:match(j,k))=1);
@for(pairs(i,j):@bin(match(i,j))); !少了:@;
end

hanghuachao 发表于 2010-4-23 14:25

大哥,打包一起卖啊,卖贵点也比让我们一个一个下好啊

qkhhmtvc 发表于 2010-4-23 14:48

顶顶,赚赚体力。。。。。。。。。。。。。

jiyidezhuzhi 发表于 2010-4-23 15:12

不错啊....................................................................

starbinbin 发表于 2010-4-24 14:38

回复 5# jiyidezhuzhi


    不错什么啊???

starbinbin 发表于 2010-4-24 14:39

回复 4# qkhhmtvc


    呵呵~~
页: [1]
查看完整版本: lingo的高手麻烦请进!!!