求帮忙看看这个lingo程序那里错了。总是要报语法错误,刚刚开始学,所以不太懂。
MODEL:sets:q/1/;points/1..12/;edges/1..19/;roads(points,points):X;flow(points,q):B;ca...
MODEL:
sets:
q/1/;
points/1..12/;
edges/1..19/;
roads(points,points): X;
flow(points,q): B;
capacity(q,edges): C;
network(points,edges): N; !矩阵的设置,额,不知道为什么有了注释,下面的endsets就要变成绿色。。;
endsets
data:
B =
1
0
0
0
0
0
0
0
0
0
0
-1;
N =
0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0
0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;
C = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;
Enddata
min=@sum(roads:C*X);
@for(points(i)| N(i,j)*X(i,j) #eq# B(j,1)
@for(points(i)|X(i,j) #eq# 1 #OR# X(i,j) #eq# 0);
END 展开
sets:
q/1/;
points/1..12/;
edges/1..19/;
roads(points,points): X;
flow(points,q): B;
capacity(q,edges): C;
network(points,edges): N; !矩阵的设置,额,不知道为什么有了注释,下面的endsets就要变成绿色。。;
endsets
data:
B =
1
0
0
0
0
0
0
0
0
0
0
-1;
N =
0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0
0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1;
C = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;
Enddata
min=@sum(roads:C*X);
@for(points(i)| N(i,j)*X(i,j) #eq# B(j,1)
@for(points(i)|X(i,j) #eq# 1 #OR# X(i,j) #eq# 0);
END 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询