资源描述:
《lingo练习代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、sets:mat/1..7/:x;endsetsmin=0.2*x(1)+0.25*x(2)+0.15*x(3)+0.22*x(4)+0.24*x(5)+0.10*x(6)+0.165*x(7);2.5*x(1)+3*x(2)=A;0.3*x(3)+90*x(4)+96*x(5)+0.4*x(6)+0.6*x(7)=B;1.3*x(1)+0.8*x(2)+4*x(5)+1.2*x(6)=C;0.025*x(1)+0.03*x(2)>=0.02*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));0.025*x(1)+0.0
2、3*x(2)<=0.03*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));0.003*x(3)+0.90*x(4)+0.96*x(5)+0.004*x(6)+0.006*x(7)>=0.004*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));0.003*x(3)+0.90*x(4)+0.96*x(5)+0.004*x(6)+0.006*x(7)<=0.006*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));0.013*x(1)+0.008*x(2)+0.04*x(5)
3、+0.012*x(6)>=0.012*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));0.013*x(1)+0.008*x(2)+0.04*x(5)+0.012*x(6)<=0.0165*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));x(1)<=380;x(2)<=300;x(3)<=600;x(4)<=500;x(5)<=200;x(6)<=300;x(7)<=250;x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)=500;model:!6发点8问题;sets:war
4、ehouses/wh1..wh6/:capacity;vendors/v1..v8/:demand;links(warehouses,vendors):cost,volume;endsets!目标函数;min=@sum(links:cost*volum);!需求约束;@for(vendors(J):@sum(warehouses(I):volume(I,J)),=demand(J));!产量约束;@for(warehouses(I):@sum(vendors(J):volume(I,J)<=capacity(I);!这里是数据;data:cap
5、acity=605551434152;demand=3537223241324338;cost=626742954953858252197433767392712395726555228143;enddataendmodel:sets:shiduan/1..7/:t,k;xinhao/1..4/:a,b,c,d,pmin,pmax,m;feiyong(shiduan,xinhao):p,w,x;endsetsdata:t=6,3,3,2,4,4,2;k=12000,32000,25000,36000,25000,30000,18000;a=50
6、00,1600,2400,1200;b=2.7,2.2,1.8,3.8;d=2250,1800,3750,4800;pmin=750,1000,1200,1800;pmax=1750,1500,2000,3500;m=10,4,8,3;enddatamin=@sum(feiyong(i,j):(a(j)+d(j)*t(i)+(p(i,j)-pmin(j))*b(j)*t(i))*x(i,j));@for(feiyong(i,j):p(i,j)>=pmin(j));@for(feiyong(i,j):p(i,j)<=pmax(j));@for(s
7、hiduan(i):@sum(xinhao(j):p(i,j)*x(i,j))=k(i));@for(feiyong(i,j):@bnd(0,x(i,j),m(j)));@for(feiyong:@gin(x));end