LINGO编程为什么出不了。请高手帮忙呀

来源:百度知道 编辑:UC知道 时间:2024/07/07 19:14:05
!We have a network of 7 cities.We want to find
the length of the shortest route from city 1 to city 7;

sets:
!Here is our primitive set of seven cities;
cities/A,B1,B2,C1,C2,C3,D/;

!The Derived set "roads" lists the roads that
exist between the cities;
road(cities,cities)/
A,B1 A,B2 B1,C1 B1,C2 B1,C3 B2,C1 B2,C2 B2,C3
C1,D C2,D C3,D/: w,x;
endsets

data:
!Here are the distances that correspond
to above links;
w=2 4 3 3 1 2 3 1 1 3 4;
enddata

n=@size(citise);!The number of cities;
min=@sum(road:w*x);
@for(cities(i)|i=#ne#1#and#i#ne#n:
@sum(roads(i,j):x(i,j))=@sum(roads(j,i):x(j,i));
@sum(roads(i,j)|i#eq#1:x(i,j))=1;
END

麻烦帮我看下我的程序有什么问题。。
运行结果说错误代码1017
我的积分是全部就这么些了。真是不好意思,麻烦知道的高手帮忙点下。。万分感谢

1.集合名字前后不一致:
定义中使用cities和road,而在程序中却是citise和roads,
2.i=#ne#1是有毛病的,#ne#是不等于,而前面加个=是什么意思呢?
修改的程序如下:
sets:
!Here is our primitive set of seven cities;
cities/A,B1,B2,C1,C2,C3,D/;

!The Derived set "roads" lists the roads that
exist between the cities;
roads(cities,cities)/
A,B1 A,B2 B1,C1 B1,C2 B1,C3 B2,C1 B2,C2 B2,C3
C1,D C2,D C3,D/: w,x;
endsets

data:
!Here are the distances that correspond
to above links;
w=2 4 3 3 1 2 3 1 1 3 4;
enddata

min=@sum(roads:w*x);
n=@size(cities);!he number of cities;
@for(cities(i)|i#ne#1#and#i#ne#n:
@sum(roads(i,j):x(i,j))=@sum(roads(j,i):x(j,i)));
@sum(roads(i,j)|i#eq#1:x(i,j))=1;

END
运行结果如下:
Global optimal solution found.
Objective value: 6.000000
Total solver iterations: 0

Variable Value Reduced Cost
N 7.000000 0.000000
W( A, B1) 2.000