作业帮 > 综合 > 作业

model:title Location problem; sets:demand/1..6/:a,b,d; suppl

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/08/11 21:04:54
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; suppl
少右括号 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);)