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/06/24 05:31:43
![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](/uploads/image/z/10354867-43-7.jpg?t=lingo%E7%BC%96%E7%A8%8B%E5%87%BA%E7%8E%B0%E8%80%81%E5%87%BA%E9%94%99%2CModel%3ATitle+Location+Problem%3Bsets%3Ademand%2F1..6%2F%3Aa%2Cb%2Cd%3Bsupply%2F1..2%2F%3Ax%2Cy%2Ce%3Blink%28demand%2Csupply%29%3Ac%3Bendsetsdata%3Aa%3D1.25%2C8.75%2C0.5%2C5.75%2C3%2C7.25%3Bb%3D1.25%2C0.75%2C4.75%2C5%2C6.5%2C7.75%3Bd%3D3%2C5%2C4%2C7%2C6%2C11%3Be%3D20%2C20%3Benddatainit%3Ax%2Cy%3D5%2C1%2C2%2C7%3Bendinit%5BOBJ%5D+m)
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))