在限制条件那里有点不同,我就是不知道是不是那里错了,我是分步考虑的,就是将它的最优分为存储费+成本费+运输费合起来,在存储费上我编的程序是
model:
sets:
kinds/1..10/:c_p,d,w,v,Q,s,N;
fa/A1,A2,A3/i;
hw/m1..m10/j;
links(fa,hw):p,x;
endsets
min=@sum(kinds:0.5*c_p*(Q-s)^2/Q+s^3/Q);
@sum(links(i,j):p(i,j)*x(i,j))<=T
@for(wh(j)sum(fa(i):x(i,j))=Qj(j));
@sum(kinds:v*(Q-s))<=w;
@for(kinds:N=d/Q;@gin(N));
endsets
data:
c_p=40,70,90,100,120,120,150,160,180,200;
d=3800,3600,3640,3250,3140,3340,3140,3230,3740,3900;
w=3900;
v=1.5,1.0,1.5,2.0,1.5,0.5,1.5,0.5,1.5,2.0,1.0,0.5;
p=100,1000000,210,250,290,300,1000000,430,450,500
90,180,1000000,240,1000000,305,380,435,1000000,490,
1000000,170,210,245,1000000,285,400,1000000,450,480;
enddata
end
有很多说是语法错误的,麻烦各位大哥帮下忙了 |