model:title Location problem; sets:demand/1..6/:a,b,d; supply/1,2/:x,y,e; link(demand,supply):c; e
model:title Location problem; sets:demand/1..6/:a,b,d; supply/1,2/:x,y,e; link(demand,supply):c; e
照书上写的,还是出错了.大惑不解.
错误代码:50
for函数使用不当
所用版本为lingo11
model:
title Location problem;
sets:
demand/1..6/:a,b,d;
supply/1,2/:x,y,e;
link(demand,supply):c;
endsets
data:
a=1.25 8.75 0.5 5.75 3 7.25;
b=1.25 0.75 4.75 5 6.5 7.75;
enddata
init:
x,y=5,1,2,7;
endinit
[obj]min=@SUM( link(i,j):c(i,j)*((x(j)-a(i))^2+(y(j)-b(i)^2)^(1/2));
@for(demand(i):@sum(supply(j):c(i,j);)=d(i));
@for(supply(i):@sum(demand(j):c(j,i);)
少右括号 model:
title Location problem;
sets:
demand/1..6/:a,b,d;
supply/1,2/:x,y,e;
link(demand,supply):c;
endsets
data:
a=1.25 8.75 0.5 5.75 3 7.25;
b=1.25 0.75 4.75 5 6.5 7.75;
enddata
init:
x,y=5,1,2,7;
endinit
[obj]min=@SUM( link(i,j): c(i,j)*((x(j)-a(i))^2+(y(j)-b(i)^2)^(1/2)));
@for(demand(i): @sum(supply(j):c(i,j);)=d(i));
@for(supply(i): @sum(demand(j):c(j,i);)
end