用Lingo编写个程序,求最大值。。。
求目标函数Z的最大值以及所有b,s,x,m.条件:已知y(i),d(i),dist(i,j);s>0;x取整;m>0;1<b(i)<1.2Z=s(1)+s(2)+s(3)...
求目标函数Z的最大值以及所有b,s,x,m.
条件:已知y(i),d(i),dist(i,j);
s>0;x取整;m>0;
1<b(i)<1.2
Z=s(1)+s(2)+s(3)+......+s(154)+y(1)*b(1)+y(2)*b(2)+y(3)*b(3)+......+y(21)*b(21);
s(i)=sum(m(i,j)) , j=1......154;
y(i)=x(i,1)+x(i,2)......+x(i,154);
d(i)=sum(t(i,j)*m(j,i))+sum(t(i,j)*x(j,i)) 当 dist(i,j)=0时t(i)=1,当0<dist(i,j)<10时t(i)=2,当dist(i,j)>10时t=3.33;
20x(i)<s(i)<40x(i);
想了一下午也没想出来怎么写。。。QwQ 展开
条件:已知y(i),d(i),dist(i,j);
s>0;x取整;m>0;
1<b(i)<1.2
Z=s(1)+s(2)+s(3)+......+s(154)+y(1)*b(1)+y(2)*b(2)+y(3)*b(3)+......+y(21)*b(21);
s(i)=sum(m(i,j)) , j=1......154;
y(i)=x(i,1)+x(i,2)......+x(i,154);
d(i)=sum(t(i,j)*m(j,i))+sum(t(i,j)*x(j,i)) 当 dist(i,j)=0时t(i)=1,当0<dist(i,j)<10时t(i)=2,当dist(i,j)>10时t=3.33;
20x(i)<s(i)<40x(i);
想了一下午也没想出来怎么写。。。QwQ 展开
展开全部
说实话你写的很乱 有些地方表达都是混乱的 我只能给你写成这样
sets:
sj/1..154/:s;
si/1..21/:b,y,d;
sij(si,sj):m,x,dist,t;
endsets
calc:
@for(sij:t=@if(dist#eq#0,1,@if(dist#le#10,2,3.33)));
endcalc
max=@sum(sj:s)+@sum(si:y*b);
@for(sj(j):s(j)=@sum(si(i):m(i,j)));
@for(si(i):y(i)=@sum(sj(j):x(i,j)));
@for(si(i):d(i)=@sum(sj(j):t(i,j)*m(i,j)+t(i,j)*x(i,j)));
@for(sij(i,j):s(j)>=20*x(i,j);s(j)<=40*x(i,j));
@for(si(i):@bnd(1,b(i),1.2));
@for(sij:@gin(x));
sets:
sj/1..154/:s;
si/1..21/:b,y,d;
sij(si,sj):m,x,dist,t;
endsets
calc:
@for(sij:t=@if(dist#eq#0,1,@if(dist#le#10,2,3.33)));
endcalc
max=@sum(sj:s)+@sum(si:y*b);
@for(sj(j):s(j)=@sum(si(i):m(i,j)));
@for(si(i):y(i)=@sum(sj(j):x(i,j)));
@for(si(i):d(i)=@sum(sj(j):t(i,j)*m(i,j)+t(i,j)*x(i,j)));
@for(sij(i,j):s(j)>=20*x(i,j);s(j)<=40*x(i,j));
@for(si(i):@bnd(1,b(i),1.2));
@for(sij:@gin(x));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询