lingo编程出现老出错,Model:Title Location Problem;sets:demand/1..6/:a,b,d;supply/1..2/:x,y,e;link(demand,supply):c;endsetsdata:a=1.25,8.75,0.5,5.75,3,7.25;b=1.25,0.75,4.75,5,6.5,7.75;d=3,5,4,7,6,11;e=20,20;enddatainit:x,y=5,1,2,7;endinit[OBJ] m

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 21:36:47
lingo编程出现老出错,Model:TitleLocationProblem;sets:demand/1..6/:a,b,d;supply/1..2/:x,y,e;link(demand,suppl

lingo编程出现老出错,Model:Title Location Problem;sets:demand/1..6/:a,b,d;supply/1..2/:x,y,e;link(demand,supply):c;endsetsdata:a=1.25,8.75,0.5,5.75,3,7.25;b=1.25,0.75,4.75,5,6.5,7.75;d=3,5,4,7,6,11;e=20,20;enddatainit:x,y=5,1,2,7;endinit[OBJ] m
lingo编程出现老出错,
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;
d=3,5,4,7,6,11;
e=20,20;
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):[DEMAND_CON] @sum(supply(j):c(i,j))=d(i););
@for(supply(i):[SUPPLY_CON] @sum(demand(j):c(j,i))

lingo编程出现老出错,Model:Title Location Problem;sets:demand/1..6/:a,b,d;supply/1..2/:x,y,e;link(demand,supply):c;endsetsdata:a=1.25,8.75,0.5,5.75,3,7.25;b=1.25,0.75,4.75,5,6.5,7.75;d=3,5,4,7,6,11;e=20,20;enddatainit:x,y=5,1,2,7;endinit[OBJ] m
你就倒数第二行错了,改过的如下:可以运行出结果
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;
d=3,5,4,7,6,11;
e=20,20;
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))