《线性规划模型的编程求解运筹学报告文档.pdf》由会员分享,可在线阅读,更多相关《线性规划模型的编程求解运筹学报告文档.pdf(10页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-运筹学实验报告 一、实验名称:线性规划模型的编程求解(2)二、实验目的:1.掌握 Lingo 软件中变量定界函数,集合循环函数和IF(条件,true 结果,false 结果)2.熟悉运输问题的数学模型,掌握简单运输问题数学模型的 Lingo 软件编程求解的方法,掌握解报告的内容 3.掌握整数规划、0-1 规划和指派问题的计算机求解方法。三、实验要求:1.给出所求解问题的数学模型;2.给出 Lingo 中的编程程序;3.能给出最优解和最优值;四、报告正文(文挡,数据,模型,程序,图形):1利用lingo 软件求解下面运输问题的最优解。单 位 销地 运 价 产地 B1 B2 B3 B4 产量 A
2、1 3 11 3 10 7 A2 1 9 2 8 4 A3 7 4 10 5 9 销量 3 6 5 6 程序:model:sets:AH/A1.A3/:A;BD/B1.B4/:B;link(AH,BD):C,X;endsets data:A=7,4,9;-B=3,6,5,6;C=3 11 3 10 1 9 2 8 7 4 10 5;enddata min=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;Global optimal
3、solution found.Objective value:85.00000 Objective bound:85.00000 Infeasibilities:0.000000 Extended solver steps:0 Total solver iterations:0 Variable Value Reduced Cost A(A1)7.000000 0.000000 A(A2)4.000000 0.000000 A(A3)9.000000 0.000000 B(B1)3.000000 0.000000 B(B2)6.000000 0.000000 B(B3)5.000000 0.0
4、00000 B(B4)6.000000 0.000000 C(A1,B1)3.000000 0.000000 C(A1,B2)11.00000 0.000000 C(A1,B3)3.000000 0.000000 C(A1,B4)10.00000 0.000000 C(A2,B1)1.000000 0.000000 C(A2,B2)9.000000 0.000000 C(A2,B3)2.000000 0.000000 C(A2,B4)8.000000 0.000000 C(A3,B1)7.000000 0.000000 C(A3,B2)4.000000 0.000000 C(A3,B3)10.
5、00000 0.000000 C(A3,B4)5.000000 0.000000 X(A1,B1)0.000000 3.000000 X(A1,B2)0.000000 11.00000 X(A1,B3)5.000000 3.000000 X(A1,B4)2.000000 10.00000 X(A2,B1)3.000000 1.000000-X(A2,B2)0.000000 9.000000 X(A2,B3)0.000000 2.000000 X(A2,B4)1.000000 8.000000 X(A3,B1)0.000000 7.000000 X(A3,B2)6.000000 4.000000
6、 X(A3,B3)0.000000 10.00000 X(A3,B4)3.000000 5.000000 Row Slack or Surplus Dual Price 1 85.00000 -1.000000 2 0.000000 0.000000 3 0.000000 0.000000 4 0.000000 0.000000 5 0.000000 0.000000 6 0.000000 0.000000 7 0.000000 0.000000 8 0.000000 0.000000 2.求解下面混合整数规划 min z=-3x1+4x2-2x3+5x4;4x1-x2+2x3-x4=-2;x
7、1+x2+3x3-x4 14;-2x1+3x2-x3+2x42;x1为整数,x2=0或1,x30,x4无约束;程序:model:sets:location1/1.4/:A,x;location2/1.3/:B;link(location2,location1):C;endsets data:A=-3,4,-2,5;B=-2,14,2;C=4,-1,2,-1-1,1,3,-1 -2,3,-1,2;enddata min=sum(location1:A*x);sum(location1(j):C(1,j)*x(j)=-2;sum(location1(j):C(2,j)*x(j)=2;gin(x(1
8、);bin(x(2);gin(x(3);free(x(4);end 结果:z=9;Global optimal solution found.Objective value:9.000000 Objective bound:9.000000 Infeasibilities:0.000000 Extended solver steps:0 Total solver iterations:6 Model Class:MILP Total variables:4 Nonlinear variables:0 Integer variables:3 Total constraints:4 Nonline
9、ar constraints:0 Total nonzeros:16 Nonlinear nonzeros:0 Variable Value Reduced Cost A(1)-3.000000 0.000000 A(2)4.000000 0.000000 A(3)-2.000000 0.000000 A(4)5.000000 0.000000 X(1)0.000000 17.00000 X(2)1.000000 -1.000000 X(3)0.000000 8.000000 X(4)1.000000 0.000000 B(1)-2.000000 0.000000 B(2)14.00000 0
10、.000000 B(3)2.000000 0.000000 C(1,1)4.000000 0.000000-C(1,2)-1.000000 0.000000 C(1,3)2.000000 0.000000 C(1,4)-1.000000 0.000000 C(2,1)1.000000 0.000000 C(2,2)1.000000 0.000000 C(2,3)3.000000 0.000000 C(2,4)-1.000000 0.000000 C(3,1)-2.000000 0.000000 C(3,2)3.000000 0.000000 C(3,3)-1.000000 0.000000 C
11、(3,4)2.000000 0.000000 Row Slack or Surplus Dual Price 1 9.000000 -1.000000 2 0.000000 5.000000 3 14.00000 0.000000 4 3.000000 0.000000 3.现在要在五个工人中确定四个人来分别完成四项工作中的一项工作。由于每个工人的技术特长不同,他们完成各项工作所需的工时也不同。每个工人完成各项工作所需工时如下表所示,试找出一个工作分配方案,使总工时最小。A B C D 9 4 3 7 4 6 5 6 5 4 7 5 7 5 2 3 10 6 7 4 程序:model:sets
12、:worker/1.5/:A;job/1.4/:B;link(worker,job):C,X;endsets data:C=9 4 3 7 4 6 5 6 工 作 工 人-5 4 7 5 7 5 2 3 10 6 7 4;enddata min=sum(link:c*x);for(worker(i):sum(job(j):x(i,j)=1;x1+x2+x6=1;x3+x4=1;x3+x4+x5=1;x4+x5=1;x2+x6=1;程序:model:sets:place1/1.6/:x;place2/1.6/;link(place2,place1):C;endsets data:C=1 1 0
13、0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 1;enddata min=sum(place1:x);for(place2(i):sum(place1(j):C(i,j)*x(j)=1);for(place1:bin(x);end 结果:z=2;选二和四地区 Global optimal solution found.Objective value:2.000000 Objective bound:2.000000 Infeasibilities:0.000000 Extended solver steps:0
14、Total solver iterations:0 Model Class:PILP Total variables:6 Nonlinear variables:0 Integer variables:6-Total constraints:7 Nonlinear constraints:0 Total nonzeros:20 Nonlinear nonzeros:0 Variable Value Reduced Cost X(1)0.000000 1.000000 X(2)1.000000 1.000000 X(3)0.000000 1.000000 X(4)1.000000 1.00000
15、0 X(5)0.000000 1.000000 X(6)0.000000 1.000000 C(1,1)1.000000 0.000000 C(1,2)1.000000 0.000000 C(1,3)0.000000 0.000000 C(1,4)0.000000 0.000000 C(1,5)0.000000 0.000000 C(1,6)0.000000 0.000000 C(2,1)1.000000 0.000000 C(2,2)1.000000 0.000000 C(2,3)0.000000 0.000000 C(2,4)0.000000 0.000000 C(2,5)0.000000
16、 0.000000 C(2,6)1.000000 0.000000 C(3,1)0.000000 0.000000 C(3,2)0.000000 0.000000 C(3,3)1.000000 0.000000 C(3,4)1.000000 0.000000 C(3,5)0.000000 0.000000 C(3,6)0.000000 0.000000 C(4,1)0.000000 0.000000 C(4,2)0.000000 0.000000 C(4,3)1.000000 0.000000 C(4,4)1.000000 0.000000 C(4,5)1.000000 0.000000 C(
17、4,6)0.000000 0.000000 C(5,1)0.000000 0.000000 C(5,2)0.000000 0.000000 C(5,3)0.000000 0.000000 C(5,4)1.000000 0.000000 C(5,5)1.000000 0.000000 C(5,6)0.000000 0.000000 C(6,1)0.000000 0.000000-C(6,2)1.000000 0.000000 C(6,3)0.000000 0.000000 C(6,4)0.000000 0.000000 C(6,5)0.000000 0.000000 C(6,6)1.000000 0.000000 Row Slack or Surplus Dual Price 1 2.000000 -1.000000 2 0.000000 0.000000 3 0.000000 0.000000 4 0.000000 0.000000 5 0.000000 0.000000 6 0.000000 0.000000 7 0.000000 0.000000