作业帮 > 综合 > 作业

lingo for函数 错误

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/08 00:37:02
lingo for函数 错误
model:
title location problem;
sets:
demand/1..15/:a,b,d;
supply/1..5/:x,y,e;
link(demand,supply):c;
endsets
data:
a=1.25,8.75,0.5,5.75,3,7.25,3.24,8.75,1.75,7.75,2.25,4.25,6.25,5,6.25;
b=1.25,0.75,4.75,5,6.5,7.75,4.75,4.25,7.75,7.25,2.25,5.25,4.50,3.0,5.75;
d=3,5,4,7,6,11,8,10,6,4,6,3,4,3,7;
e=15,20,15,18,22;
enddata
init:
x=1.5,8.25,1.75,7.0,4.25;
y=1.5,1.75,7.5,7.0,5.0;
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):[DEMAND_CON] @sum(demand(j):c(i,j)) =d(i););
@for(supply(i):[SUPPLY_CON] @sum((j):c(j,i))
model:
title location problem;
sets:
demand/1..15/:a,b,d;
supply/1..5/:x,y,e;
link(demand,supply):c;
endsets
data:
a=1.25,8.75,0.5,5.75,3,7.25,3.24,8.75,1.75,7.75,2.25,4.25,6.25,5,6.25;
b=1.25,0.75,4.75,5,6.5,7.75,4.75,4.25,7.75,7.25,2.25,5.25,4.50,3.0,5.75;
d=3,5,4,7,6,11,8,10,6,4,6,3,4,3,7;
e=15,20,15,18,22;
enddata
init:
x=1.5,8.25,1.75,7.0,4.25;
y=1.5,1.75,7.5,7.0,5.0;
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):[DEMAND_CON] @sum(supply(j):c(i,j)) =d(i););
@for(supply(j):[SUPPLY_CON] @sum(demand(i):c(i,j))
再问: 能出来结果吗?
再答: 你算一会看看啊 这种非线性规划当然算的慢
再问:
再答: 反正我这里没有问题 你那你有问题我就不知道什么原因了 不行你删掉init段试试
再问: 你加我 826397813