数学建模社区-数学中国
标题:
求助
[打印本页]
作者:
kenstorm
时间:
2009-5-12 03:46
标题:
求助
MODEL:
Titel Location problem;
sets:
demand/1..6/:a,b,d;
supply/1..2/:x,y,e;
Link(demand,supply):c;
endsets
data:
!Locations for the demand(需求点的位置);
a=1.25,8.75,0.5,5.75,3,7.25;
b=1.25,0.75,4.75,5,6.5,7.75;
!quantites of the demand and supply(供需量);
d=3,5,4,7,6,11;e=20,20;
enddata
init:
!initial Locations for the supply(初始点);
x,y=5 1 2 7;
endinit
!Objective function(目标);
[OBJ]min=@sum(Link(i,j):c(i,j)*((x(j)-a(i))^2+(y(j)-b(i))^2)^(1/2));
!demand constraints(需求约束);
@for(demand(i):[DEMAND_CON]@sum(supply(j):c(i,j))=d(i););
!supply constraints(供应约束);
@for(supply(i):[SUPPLY_CON]@sum(demand(j):c(i,j))<=e(i););
@for(supplyfree(X);@free(Y););
END
model:
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(supply(j):c(i,j))<=e(i););
@for(supplyfree(x);@free(y););
end
以上两段代码,前者无法运算,但是我看不出有什么错误的地方,请高手指点,还有,后面一个如果加上Titel Location problem;也不能求解,请问加标题正确的代码是怎样的,谢谢啦
作者:
dangdang168
时间:
2009-5-20 00:57
MODEL:
title:Location problem;
sets:
demand/1..6/:a,b,d;
supply/1..2/:x,y,e;
Link(demand,supply):c;
endsets
data:
!Locations for the demand(需求点的位置);
a=1.25,8.75,0.5,5.75,3,7.25;
b=1.25,0.75,4.75,5,6.5,7.75;
!quantites of the demand and supply(供需量);
d=3,5,4,7,6,11;e=20,20;
enddata
init:
!initial Locations for the supply(初始点);
x,y=5 1 2 7;
endinit
!Objective function(目标);
[OBJ]min=@sum(Link(i,j):c(i,j)*((x(j)-a(i))^2+(y(j)-b(i))^2)^(1/2));
!demand constraints(需求约束);
@for(demand(i):@sum(supply(j):c(i,j))=d(i););
@for(supply(i):@sum(demand(j):c(j,i))<=e(i););
@for(supply(I):@free(I););
END
作者:
dangdang168
时间:
2009-5-20 00:59
第二段正确代码如下:
model:
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(supply(j):c(i,j))<=e(i););
@for(supply(i):@free(i););
end
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/)
Powered by Discuz! X2.5