《运筹学实验报告4(运输问题的编程求解.doc》由会员分享,可在线阅读,更多相关《运筹学实验报告4(运输问题的编程求解.doc(10页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上运筹学实验报告实验课程:运筹学 实验日期: 6月9日 任课教师: 杨小康 班级:信息与计算科学 姓名:刘静 学号 一、实验名称: 线性规划模型的编程求解(2) 二、实验目的:1.掌握Lingo软件中变量定界函数,集合循环函数和IF(条件,true结果,false结果)2. 熟悉运输问题的数学模型,掌握简单运输问题数学模型的Lingo软件编程求解的方法,掌握解报告的内容3. 掌握整数规划、0-1规划和指派问题的计算机求解方法。三、实验要求: 1.给出所求解问题的数学模型;2.给出Lingo中的编程程序;3.能给出最优解和最优值;四、报告正文(文挡,数据,模型,程序,图形
2、):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=3 11 3 10 1 9 2 8 7 4 10 5;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结
3、果:z=85;Global optimal solution found. Objective value: 85.00000 Objective bound: 85.00000 Infeasibilities: 0. Extended solver steps: 0 Total solver iterations: 0 Variable Value Reduced Cost A( A1) 7. 0. A( A2) 4. 0. A( A3) 9. 0. B( B1) 3. 0. B( B2) 6. 0. B( B3) 5. 0. B( B4) 6. 0. C( A1, B1) 3. 0. C(
4、 A1, B2) 11.00000 0. C( A1, B3) 3. 0. C( A1, B4) 10.00000 0. C( A2, B1) 1. 0. C( A2, B2) 9. 0. C( A2, B3) 2. 0. C( A2, B4) 8. 0. C( A3, B1) 7. 0. C( A3, B2) 4. 0. C( A3, B3) 10.00000 0. C( A3, B4) 5. 0. X( A1, B1) 0. 3. X( A1, B2) 0. 11.00000 X( A1, B3) 5. 3. X( A1, B4) 2. 10.00000 X( A2, B1) 3. 1.
5、X( A2, B2) 0. 9. X( A2, B3) 0. 2. X( A2, B4) 1. 8. X( A3, B1) 0. 7. X( A3, B2) 6. 4. X( A3, B3) 0. 10.00000 X( A3, B4) 3. 5. Row Slack or Surplus Dual Price 1 85.00000 -1. 2 0. 0. 3 0. 0. 4 0. 0. 5 0. 0. 6 0. 0. 7 0. 0. 8 0. 0.2.求解下面混合整数规划min z=-3x1+4x2-2x3+5x4;4x1-x2+2x3-x4=-2;x1+x2+3x3-x414;-2x1+3
6、x2-x3+2x42;x1为整数,x2=0或1,x30,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,-1 1,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)=2;gin(x(1);bin(x(2);gin(x(3)
7、;free(x(4);end结果:z=9; Global optimal solution found. Objective value: 9. Objective bound: 9. Infeasibilities: 0. Extended solver steps: 0 Total solver iterations: 6 Model Class: MILP Total variables: 4 Nonlinear variables: 0 Integer variables: 3 Total constraints: 4 Nonlinear constraints: 0 Total no
8、nzeros: 16 Nonlinear nonzeros: 0 Variable Value Reduced Cost A( 1) -3. 0. A( 2) 4. 0. A( 3) -2. 0. A( 4) 5. 0. X( 1) 0. 17.00000 X( 2) 1. -1. X( 3) 0. 8. X( 4) 1. 0. B( 1) -2. 0. B( 2) 14.00000 0. B( 3) 2. 0. C( 1, 1) 4. 0. C( 1, 2) -1. 0. C( 1, 3) 2. 0. C( 1, 4) -1. 0. C( 2, 1) 1. 0. C( 2, 2) 1. 0.
9、 C( 2, 3) 3. 0. C( 2, 4) -1. 0. C( 3, 1) -2. 0. C( 3, 2) 3. 0. C( 3, 3) -1. 0. C( 3, 4) 2. 0. Row Slack or Surplus Dual Price 1 9. -1. 2 0. 5. 3 14.00000 0. 4 3. 0.3. 现在要在五个工人中确定四个人来分别完成四项工作中的一项工作。由于每个工人的技术特长不同,他们完成各项工作所需的工时也不同。每个工人完成各项工作所需工时如下表所示,试找出一个工作分配方案,使总工时最小。工作工人ABCD943746565475752310674程序:m
10、odel:sets: worker/1.5/:A; job/1.4/:B; link(worker,job):C,X; endsetsdata:C=9 4 3 7 4 6 5 6 5 4 7 5 7 5 2 3 10 6 7 4;enddatamin=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; endsetsdata:C=
11、1 1 0 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;enddatamin=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. Objective bound: 2. Infeasibilities: 0. Extended solver steps: 0 Total solv
12、er 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. 1. X( 2) 1. 1. X( 3) 0. 1. X( 4) 1. 1. X( 5) 0. 1. X( 6) 0. 1. C( 1, 1) 1. 0.
13、C( 1, 2) 1. 0. C( 1, 3) 0. 0. C( 1, 4) 0. 0. C( 1, 5) 0. 0. C( 1, 6) 0. 0. C( 2, 1) 1. 0. C( 2, 2) 1. 0. C( 2, 3) 0. 0. C( 2, 4) 0. 0. C( 2, 5) 0. 0. C( 2, 6) 1. 0. C( 3, 1) 0. 0. C( 3, 2) 0. 0. C( 3, 3) 1. 0. C( 3, 4) 1. 0. C( 3, 5) 0. 0. C( 3, 6) 0. 0. C( 4, 1) 0. 0. C( 4, 2) 0. 0. C( 4, 3) 1. 0. C( 4, 4) 1. 0. C( 4, 5) 1. 0. C( 4, 6) 0. 0. C( 5, 1) 0. 0. C( 5, 2) 0. 0. C( 5, 3) 0. 0. C( 5, 4) 1. 0. C( 5, 5) 1. 0. C( 5, 6) 0.