资源描述:
《数学建模中选址问题(Lingo程序).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、P94,例3.4选址问题目录题目1第一步,旧址基础上只求运量的LP程序1第二步,旧址基础上选择新址的NLP程序2题目6个工地的地址(坐标表示,距离单位KM)及水泥用量(单位:吨)如下表,而在P(5,1)及Q(2,7)处有两个临时料场,日储量各有20t,如何安排运输,可使总的吨公里数最小?新料场应选何处?能节约多少吨公里数?123456A1.258.750.55.7537.25B1.250.754.7556.57.75D3547611第一步,旧址基础上只求运量的LP程序MODEL:TitleLocationProblem;
2、sets:demand/1..6/:a,b,d;supply/1..2/:x,y,e;link(demand,supply):c;endsetsdata:!locationsforthedemand(需求点的位置);a=1.25,8.75,0.5,5.75,3,7.25;b=1.25,0.75,4.75,5,6.5,7.75;!quantitiesofthedemandandsupply(供需量);d=3,5,4,7,6,11;e=20,20;x,y=5,1,2,7;enddatainit:!initiallocatio
3、nsforthesupply(初始点);endinit!Objectivefunction(目标);[OBJ]min=@sum(link(i,j):c(i,j)*((x(j)-a(i))^2+(y(j)-b(i))^2)^(1/2));!demandconstraints(需求约束);@for(demand(i):[DEMAND_CON]@sum(supply(j):c(i,j))=d(i););!supplyconstraints(供应约束);@for(supply(i):[SUPPLY_CON]@sum(demand
4、(j):c(j,i))<=e(i););!@for(supply:@free(x);!@free(Y);!);@for(supply:@bnd(0.5,X,8.75);@bnd(0.75,Y,7.75););END运行可得到全局最优解Globaloptimalsolutionfound.Objectivevalue:136.2275Totalsolveriterations:1ModelTitle:LocationProblemVariableValueReducedCostX(1)5.0000000.000000X(2
5、)2.0000000.000000Y(1)1.0000000.000000Y(2)7.0000000.000000E(1)20.000000.000000E(2)20.000000.000000第二步,旧址基础上选择新址的NLP程序!选新址的NLP程序;MODEL:TitleLocationProblem;sets:demand/1..6/:a,b,d;supply/1..2/:x,y,e;link(demand,supply):c;endsetsdata:!locationsforthedemand(需求点的位置);a
6、=1.25,8.75,0.5,5.75,3,7.25;b=1.25,0.75,4.75,5,6.5,7.75;!quantitiesofthedemandandsupply(供需量);d=3,5,4,7,6,11;e=20,20;enddatainit:!initiallocationsforthesupply(初始点);!x,y=5,1,2,7;endinit!Objectivefunction(目标);[OBJ]min=@sum(link(i,j):c(i,j)*((x(j)-a(i))^2+(y(j)-b(i))^
7、2)^(1/2));!demandconstraints(需求约束);@for(demand(i):[DEMAND_CON]@sum(supply(j):c(i,j))=d(i););!supplyconstraints(供应约束);@for(supply(i):[SUPPLY_CON]@sum(demand(j):c(j,i))<=e(i););!@for(supply:@free(x);!@free(Y);!);@for(supply:@bnd(0.5,X,8.75);@bnd(0.75,Y,7.75););END求
8、解结果只得到局部最优解Localoptimalsolutionfound.Objectivevalue:89.88347Totalsolveriterations:67ModelTitle:LocationProblemVariableValueReducedCostX(1)5.6959660.000000X(2)7