model:
sets:
cities/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19/;
roads(cities,cities)/1 2,1 3,1 4,1 5,1 6,1 8,1 13,1 17,2 5,2 6,3 7,3 13,4 8,5 9,6 9,6 10,6 11,7 12,8 9,8 14,9 19,10 19,11 10,11 18,12 11,12 16,12 18,13 7,13 15,14 19,15 16,16 18,17 19,18 17,18 19/;
transportation/1,2,3/;
link(roads,transportation):d,x;
endsets
data:
d=8476.42,8406,8787,8733,8500,8889,8532,8870,259.82,100.47,249.69,289,393,89.38,242.84,207.99,201.27,90.43,126.12,94.88,97.76,86.54,85.43,141.63,103.23,62.6,93.33,131.99,95.09,71.12,147.8,50.99,193,178.06,73.16;
w=4.88,4.88,0.1539;
c=30,0.02,0.04;
q=1000;
g=48,30,19.13;
enddata
[OBJ]min=@sum(link(i,j):d(i)*q*c(j)*x(i,j))+@sum(d(i)*q*g(j)*w(n)*x(i,j));
@for @sum(x(i,j))<=1;
@for @bin(x(i,j));
@for x(8 9,3)=x(12 11,3)=x(12 16,3)=x(12 18,3)=x(15 16,3)=x(18 16,3)=0
@for i=1 2,1 3,1 4,1 5,1 6,1 8,1 13,1 17;x(i,j)=0
end
之前那个问题自己解决了,可是循环语句好像还是有问题