lingo程序求解释~
n=@size(cities);min=@sum(link(i,j)|i#ne#j:distance(i,j)*x(i,j));@sum(cities(i)|i#gt#1...
n=@size(cities);
min=@sum(link(i,j)|i#ne#j :distance(i,j)*x(i,j));
@sum(cities(i)|i#gt#1 :x(1,i))>=1;
@for(cities(i)|i#gt#1:@sum(cities(j)|j#ne#i:x(j,i))=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););
@bnd(1,level(i),999999); level(i)<=n-1-(n-2)*x(1,i); );
@for(link:@bin(x));
End
model:
sets:
cities/1..80/:level;
link(cities,cities):distance,x;
endsets
data:
distance=
;
enddata
n=@size(cities);
min=@sum(link(i,j)|i#ne#j :distance(i,j)*x(i,j));
@sum(cities(i)|i#gt#1 :x(1,i))>=1;
@for(cities(i)|i#gt#1:@sum(cities(j)|j#ne#i:x(j,i))=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););
@bnd(1,level(i),999999); level(i)<=n-1-(n-2)*x(1,i); );
@for(link:@bin(x));
End 展开
min=@sum(link(i,j)|i#ne#j :distance(i,j)*x(i,j));
@sum(cities(i)|i#gt#1 :x(1,i))>=1;
@for(cities(i)|i#gt#1:@sum(cities(j)|j#ne#i:x(j,i))=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););
@bnd(1,level(i),999999); level(i)<=n-1-(n-2)*x(1,i); );
@for(link:@bin(x));
End
model:
sets:
cities/1..80/:level;
link(cities,cities):distance,x;
endsets
data:
distance=
;
enddata
n=@size(cities);
min=@sum(link(i,j)|i#ne#j :distance(i,j)*x(i,j));
@sum(cities(i)|i#gt#1 :x(1,i))>=1;
@for(cities(i)|i#gt#1:@sum(cities(j)|j#ne#i:x(j,i))=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););
@bnd(1,level(i),999999); level(i)<=n-1-(n-2)*x(1,i); );
@for(link:@bin(x));
End 展开
2个回答
展开全部
你这个问题是什么 我只能这样给你改了
model:
sets:
cities/s,a1,a2,a3,b1,b2,c1,c2,t/:l;
roads(cities,cities)/
s,a1 s,a2 s,a3
a1,b1 a1,b2 a2,b1 a2,b2 a3,b1 a3,b2
b1,c1 b1,c2 b2,c1 b2,b2
c1,t c2,t/:d;
endsets
data:
d= 6 3 3
6 5 8 6 7 4
6 7 8 9
5 6;
enddata
calc:
l(1)=0;
@for(cities(i)|i#gt#1:
l(i)=@min(cities(j)|@in(roads,i,j):l(j)+d(i,j)););
endcalc
end
model:
sets:
cities/s,a1,a2,a3,b1,b2,c1,c2,t/:l;
roads(cities,cities)/
s,a1 s,a2 s,a3
a1,b1 a1,b2 a2,b1 a2,b2 a3,b1 a3,b2
b1,c1 b1,c2 b2,c1 b2,b2
c1,t c2,t/:d;
endsets
data:
d= 6 3 3
6 5 8 6 7 4
6 7 8 9
5 6;
enddata
calc:
l(1)=0;
@for(cities(i)|i#gt#1:
l(i)=@min(cities(j)|@in(roads,i,j):l(j)+d(i,j)););
endcalc
end
追问
我只是不懂是什么意思。程序是对的。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询