运筹学实验报告4(运输问题的编程求解)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

运筹学实验报告实验课程:运筹学实验日期:6月9日任课教师:杨小康班级:信息与计算科学姓名:刘静学号0202110123一、实验名称:线性规划模型的编程求解(2)二、实验目的:1.掌握Lingo软件中变量定界函数,集合循环函数和@IF(条件,true结果,false结果)2.熟悉运输问题的数学模型,掌握简单运输问题数学模型的Lingo软件编程求解的方法,掌握解报告的内容3.掌握整数规划、0-1规划和指派问题的计算机求解方法。三、实验要求:1.给出所求解问题的数学模型;2.给出Lingo中的编程程序;3.能给出最优解和最优值;四、报告正文(文挡,数据,模型,程序,图形):1.利用lingo软件求解下面运输问题的最优解。单位销地运价产地B1B2B3B4产量A13113107A219284A3741059销量3656程序:model:sets:AH/A1..A3/:A;BD/B1..B4/:B;link(AH,BD):C,X;endsetsdata:A=7,4,9;B=3,6,5,6;C=311310192874105;enddatamin=@sum(link:c*x);@for(AH(i):@sum(BD(j):x(i,j))=A(i));@for(BD(j):@sum(AH(i):x(i,j))=B(j));@for(link:@gin(x));end结果:z=85;Globaloptimalsolutionfound.Objectivevalue:85.00000Objectivebound:85.00000Infeasibilities:0.000000Extendedsolversteps:0Totalsolveriterations:0VariableValueReducedCostA(A1)7.0000000.000000A(A2)4.0000000.000000A(A3)9.0000000.000000B(B1)3.0000000.000000B(B2)6.0000000.000000B(B3)5.0000000.000000B(B4)6.0000000.000000C(A1,B1)3.0000000.000000C(A1,B2)11.000000.000000C(A1,B3)3.0000000.000000C(A1,B4)10.000000.000000C(A2,B1)1.0000000.000000C(A2,B2)9.0000000.000000C(A2,B3)2.0000000.000000C(A2,B4)8.0000000.000000C(A3,B1)7.0000000.000000C(A3,B2)4.0000000.000000C(A3,B3)10.000000.000000C(A3,B4)5.0000000.000000X(A1,B1)0.0000003.000000X(A1,B2)0.00000011.00000X(A1,B3)5.0000003.000000X(A1,B4)2.00000010.00000X(A2,B1)3.0000001.000000X(A2,B2)0.0000009.000000X(A2,B3)0.0000002.000000X(A2,B4)1.0000008.000000X(A3,B1)0.0000007.000000X(A3,B2)6.0000004.000000X(A3,B3)0.00000010.00000X(A3,B4)3.0000005.000000RowSlackorSurplusDualPrice185.00000-1.00000020.0000000.00000030.0000000.00000040.0000000.00000050.0000000.00000060.0000000.00000070.0000000.00000080.0000000.0000002.求解下面混合整数规划minz=-3x1+4x2-2x3+5x4;4x1-x2+2x3-x4=-2;x1+x2+3x3-x4≤14;-2x1+3x2-x3+2x4≥2;x1为整数,x2=0或1,x3≥0,x4无约束;程序:model:sets:location1/1..4/:A,x;location2/1..3/:B;link(location2,location1):C;endsetsdata:A=-3,4,-2,5;B=-2,14,2;C=4,-1,2,-11,1,3,-1-2,3,-1,2;enddatamin=@sum(location1:A*x);@sum(location1(j):C(1,j)*x(j))=-2;@sum(location1(j):C(2,j)*x(j))=14;@sum(location1(j):C(3,j)*x(j))=2;@gin(x(1));@bin(x(2));@gin(x(3));@free(x(4));end结果:z=9;Globaloptimalsolutionfound.Objectivevalue:9.000000Objectivebound:9.000000Infeasibilities:0.000000Extendedsolversteps:0Totalsolveriterations:6ModelClass:MILPTotalvariables:4Nonlinearvariables:0Integervariables:3Totalconstraints:4Nonlinearconstraints:0Totalnonzeros:16Nonlinearnonzeros:0VariableValueReducedCostA(1)-3.0000000.000000A(2)4.0000000.000000A(3)-2.0000000.000000A(4)5.0000000.000000X(1)0.00000017.00000X(2)1.000000-1.000000X(3)0.0000008.000000X(4)1.0000000.000000B(1)-2.0000000.000000B(2)14.000000.000000B(3)2.0000000.000000C(1,1)4.0000000.000000C(1,2)-1.0000000.000000C(1,3)2.0000000.000000C(1,4)-1.0000000.000000C(2,1)1.0000000.000000C(2,2)1.0000000.000000C(2,3)3.0000000.000000C(2,4)-1.0000000.000000C(3,1)-2.0000000.000000C(3,2)3.0000000.000000C(3,3)-1.0000000.000000C(3,4)2.0000000.000000RowSlackorSurplusDualPrice19.000000-1.00000020.0000005.000000314.000000.00000043.0000000.0000003.现在要在五个工人中确定四个人来分别完成四项工作中的一项工作。由于每个工人的技术特长不同,他们完成各项工作所需的工时也不同。每个工人完成各项工作所需工时如下表所示,试找出一个工作分配方案,使总工时最小。ABCDⅠ9437Ⅱ4656Ⅲ5475Ⅳ7523Ⅴ10674程序:model:sets:worker/1..5/:A;job/1..4/:B;link(worker,job):C,X;endsets工作工人data:C=943746565475752310674;enddatamin=@sum(link:c*x);@for(worker(i):@sum(job(j):x(i,j))=1);@for(job(j):@sum(worker(i):x(i,j))=1);@for(link:@bin(x));end结果:z=3+4+3+4=14;第一个人做第三个工作X(1,3),第二个人做第一个工作X(2,1),第三个人做第二个工作X(3,2),第四个人做第四个工作X(4,4);Globaloptimalsolutionfound.Objectivevalue:14.00000Objectivebound:14.00000Infeasibilities:0.000000Extendedsolversteps:0Totalsolveriterations:0VariableValueReducedCostA(1)0.0000000.000000A(2)0.0000000.000000A(3)0.0000000.000000A(4)0.0000000.000000A(5)0.0000000.000000B(1)0.0000000.000000B(2)0.0000000.000000B(3)0.0000000.000000B(4)0.0000000.000000C(1,1)9.0000000.000000C(1,2)4.0000000.000000C(1,3)3.0000000.000000C(1,4)7.0000000.000000C(2,1)4.0000000.000000C(2,2)6.0000000.000000C(2,3)5.0000000.000000C(2,4)6.0000000.000000C(3,1)5.0000000.000000C(3,2)4.0000000.000000C(3,3)7.0000000.000000C(3,4)5.0000000.000000C(4,1)7.0000000.000000C(4,2)5.0000000.000000C(4,3)2.0000000.000000C(4,4)3.0000000.000000C(5,1)10.000000.000000C(5,2)6.0000000.000000C(5,3)7.0000000.000000C(5,4)4.0000000.000000X(1,1)0.0000009.000000X(1,2)0.0000004.000000X(1,3)1.0000003.000000X(1,4)0.0000007.000000X(2,1)1.0000004.000000X(2,2)0.0000006.000000X(2,3)0.0000005.000000X(2,4)0.0000006.000000X(3,1)0.0000005.000000X(3,2)1.0000004.000000X(3,3)0.0000007.000000X(3,4)0.0000005.000000X(4,1)0.0000007.000000X(4,2)0.0000005.000000X(4,3)0.0000002.000000X(4,4)1.0000003.000000X(5,1)0.00000010.00000X(5,2)0.0000006.000000X(5,3)0.0000007.000000X(5,4)0.0000004.000000RowSlackorSurplusDualPrice114.00000-1.00000020.0000000.00000030.0000000.00000040.0000000.00000050.0000000.00000061.0000000.00000070.0000000.00000080.0000000.00000090.0000000.000000100.0000000.0000004.某市消防队布点问题。该市共有6个区,每个区都可以建消防站,市政府希望设置的消防站最少,但必须满足在城市任何地区发生火警时,消防车要在15min内赶到现场。据实地测定,各区之间消防车行驶的时间见表,请制定一个布点最少的计划。地区1地区2地区3地区4地区5地区6地区1地区2地区3地区4地区5地区60101

1 / 10
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功