请高手帮忙看下我的LINGO程序为什么老是提示第36行出问题,model:sets:cities/1..10/:level;!level(!)=the level of city;link( cities,cities):distance,the distance matrix;x;!x(i,j)=1 if we use link i,j;endsets data:distance marix,it ne
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 13:31:31
请高手帮忙看下我的LINGO程序为什么老是提示第36行出问题,model:sets:cities/1..10/:level;!level(!)=the level of city;link( cities,cities):distance,the distance matrix;x;!x(i,j)=1 if we use link i,j;endsets data:distance marix,it ne
请高手帮忙看下我的LINGO程序为什么老是提示第36行出问题,
model:
sets:
cities/1..10/:level;!level(!)=the level of city;
link( cities,cities):
distance,the distance matrix;
x;!x(i,j)=1 if we use link i,j;
endsets
data:distance marix,it need not be symmetirc;
distance= 0 8 5 9 12 14 12 16 17 22
8 0 9 15 16 8 11 18 14 22
5 9 0 7 9 11 7 12 12 17
9 15 7 0 3 17 10 7 15 15
12 16 9 3 0 8 10 6 15 15
14 8 11 17 8 0 9 14 8 16
12 11 7 10 10 9 0 8 6 11
16 18 12 7 6 14 8 0 11 11
17 14 12 15 15 8 6 11 0 10
22 22 17 15 15 16 11 11 10 0;
enddata
n = @size( cities);!the model size;
minimize total distance of the links;
min = @sum(link(i,j)|i #ne# j:distance(i,j) * x(i,j));
for city i;
@FOR( cities(i):
it must be entered;
@sum(cities(j)| j #ne# i:x(j,i)) = 1;
it must be departed;
@sum(cities(j)| j #ne# i:x(i,j)) = 1;
@for(cities(j)|j #gt# 1#and# j #ne# i:
level(j)>=level(i)+x(i,j)-(n-2)*(1-x(i,j))+(n-3)*x(j,i);
);
);
@for(link:@bin(x))
for the first and last stop;
@for(cities(i)|i#gt#1:
level(i)=1+(n-2)*x(i,1);
);
end
请高手帮忙看下我的LINGO程序为什么老是提示第36行出问题,model:sets:cities/1..10/:level;!level(!)=the level of city;link( cities,cities):distance,the distance matrix;x;!x(i,j)=1 if we use link i,j;endsets data:distance marix,it ne
提示你的前一行非注释的句子 最后没有加分号