《线性规划的灵敏度分析实验报告33203.pdf》由会员分享,可在线阅读,更多相关《线性规划的灵敏度分析实验报告33203.pdf(28页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、.运筹学/线性规划实验报告 实验室:实验日期:实验项目 线性规划的灵敏度分析 系 别 数学系 姓 名 学 号 班 级 指导教师 成 绩 .一 实验目的 掌握用 Lingo/Lindo 对线性规划问题进行灵敏度分析的方法,理解解报告的容。初步掌握对实际的线性规划问题建立数学模型,并利用计算机求解分析的一般方法。二 实验环境 Lingo 软件 三 实验容(包括数学模型、上机程序、实验结果、结果分析与问题解答等)例题2-10 MODEL:_1 MAX=2*X_1+3*X_2;_2 X_1+2*X_2+X_3=8;_3 4*X_1+X_4=16;_4 4*X_2+X_5=12;END 编程 sets:
2、is/1.3/:b;js/1.5/:c,x;links(is,js):a;endsets max=sum(js(J):c(J)*x(J);for(is(I):sum(js(J):a(I,J)*x(J)=b(I);data:c=2 3 0 0 0;b=8 16 12;a=1 2 1 0 0 4 0 0 1 0 0 4 0 0 1;end data end 灵敏度分析 Ranges in which the basis is unchanged:.Objective Coefficient Ranges Current Allowable Allowable Variable Coefficien
3、t Increase Decrease X(1)2.000000 INFINITY 0.5000000 X(2)3.000000 1.000000 3.000000 X(3)0.0 1.500000 INFINITY X(4)0.0 0.1250000 INFINITY X(5)0.0 0.7500000 0.2500000 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 2 8.000000 2.000000 4.000000 3 16.00000 16.00000 8.000000 4
4、12.00000 INFINITY 4.000000 当 b2 在 8,32之间变化时 最优基不变 最优解 Global optimal solution found at iteration:0 Objective value:14.00000 Variable Value Reduced Cost B(1)8.000000 0.000000 B(2)16.00000 0.000000 B(3)12.00000 0.000000 C(1)2.000000 0.000000 C(2)3.000000 0.000000 C(3)0.000000 0.000000 C(4)0.000000 0.0
5、00000 C(5)0.000000 0.000000 X(1)4.000000 0.000000 X(2)2.000000 0.000000 X(3)0.000000 1.500000 X(4)0.000000 0.1250000 X(5)4.000000 0.000000 A(1,1)1.000000 0.000000.A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(1,4)0.000000 0.000000 A(1,5)0.000000 0.000000 A(2,1)4.000000 0.000000 A(2,2)0.000000 0.
6、000000 A(2,3)0.000000 0.000000 A(2,4)1.000000 0.000000 A(2,5)0.000000 0.000000 A(3,1)0.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.000000 0.000000 A(3,4)0.000000 0.000000 A(3,5)1.000000 0.000000 Row Slack or Surplus Dual Price 1 14.00000 1.000000 2 0.000000 1.500000 3 0.000000 0.1250000 4 0.0000
7、00 0.000000 例题2-11 模型 MAX 2 X(1)+3 X(2)SUBJECT TO 2 X(1)+2 X(2)+X(3)=12 3 4 X(1)+X(4)=16 4 4 X(2)+X(5)=12 END 编程 sets:is/1.3/:b;js/1.5/:c,x;links(is,js):a;.endsets max=sum(js(J):c(J)*x(J);for(is(I):sum(js(J):a(I,J)*x(J)=b(I);data:c=2 3 0 0 0;b=12 16 12;a=1 2 1 0 0 4 0 0 1 0 0 4 0 0 1;end data end 最优
8、解 Global optimal solution found at iteration:2 Objective value:17.00000 Variable Value Reduced Cost B(1)12.00000 0.000000 B(2)16.00000 0.000000 B(3)12.00000 0.000000 C(1)2.000000 0.000000 C(2)3.000000 0.000000 C(3)0.000000 0.000000 C(4)0.000000 0.000000 C(5)0.000000 0.000000 X(1)4.000000 0.000000 X(
9、2)3.000000 0.000000 X(3)2.000000 0.000000 X(4)0.000000 0.5000000 X(5)0.000000 0.7500000 A(1,1)1.000000 0.000000 A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(1,4)0.000000 0.000000 A(1,5)0.000000 0.000000 A(2,1)4.000000 0.000000.A(2,2)0.000000 0.000000 A(2,3)0.000000 0.000000 A(2,4)1.000000 0.000
10、000 A(2,5)0.000000 0.000000 A(3,1)0.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.000000 0.000000 A(3,4)0.000000 0.000000 A(3,5)1.000000 0.000000 Row Slack or Surplus Dual Price 1 17.00000 1.000000 2 0.000000 0.000000 3 0.000000 0.5000000 4 0.000000 0.7500000 最优解(4,3,2,0,0)最优值z=17 分析 Ranges in whi
11、ch the basis is unchanged:Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X(1)2.000000 INFINITY 2.000000 X(2)3.000000 INFINITY 3.000000 X(3)0.0 1.500000 INFINITY X(4)0.0 0.5000000 INFINITY X(5)0.0 0.7500000 INFINITY Righthand Side Ranges Row Current Al
12、lowable Allowable RHS Increase Decrease 2 12.00000 INFINITY 2.000000 3 16.00000 8.000000 16.00000 4 12.00000 4.000000 12.00000.例题2-12 模型 MAX 2 X(1)+3 X(2)SUBJECT TO 2 X(1)+2 X(2)+X(3)=8 3 4 X(1)+X(4)=16 4 4 X(2)+X(5)=12 END 编程 sets:is/1.3/:b;js/1.5/:c,x;links(is,js):a;endsets max=sum(js(J):c(J)*x(J)
13、;for(is(I):sum(js(J):a(I,J)*x(J)=b(I);data:c=2 3 0 0 0;b=8 16 12;a=1 2 1 0 0 4 0 0 1 0 0 4 0 0 1;end data end 灵敏度分析 Ranges in which the basis is unchanged:Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X(1)2.000000 INFINITY 0.5000000 X(2)3.000000 1.00
14、0000 3.000000 X(3)0.0 1.500000 INFINITY X(4)0.0 0.1250000 INFINITY.X(5)0.0 0.7500000 0.2500000 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 2 8.000000 2.000000 4.000000 3 16.00000 16.00000 8.000000 4 12.00000 INFINITY 4.000000 由灵敏度分析表知道C2在【0,4】之间变化时,最优基不变。第六题 模型 MODEL:
15、_1 MAX=3*X_1+X_2+4*X_3;_2 6*X_1+3*X_2+5*X_3=450;_3 3*X_1+4*X_2+5*X_3=300;END 编程 sets:is/1.2/:b;js/1.3/:c,x;links(is,js):a;endsets max=sum(js(J):c(J)*x(J);for(is(I):sum(js(J):a(I,J)*x(J)=b(I);data:c=3 1 4;b=450 300;a=6 3 5 3 4 5;end data End 最优解 Global optimal solution found.Objective value:270.0000.
16、Infeasibilities:0.000000 Total solver iterations:2 Variable Value Reduced Cost B(1)450.0000 0.000000 B(2)300.0000 0.000000 C(1)3.000000 0.000000 C(2)1.000000 0.000000 C(3)4.000000 0.000000 X(1)50.00000 0.000000 X(2)0.000000 2.000000 X(3)30.00000 0.000000 A(1,1)6.000000 0.000000 A(1,2)3.000000 0.0000
17、00 A(1,3)5.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)4.000000 0.000000 A(2,3)5.000000 0.000000 Row Slack or Surplus Dual Price 1 270.0000 1.000000 2 0.000000 0.2000000 3 0.000000 0.6000000 第一问:A 生产 50 B 生产 0 C 生产 30 有最高利润 270 元;第二问:单个价值系数和右端系数变化围的灵敏度分析结果 Ranges in which the basis is unchanged:Ob
18、jective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X(1)3.000000 1.800000 0.6000000 X(2)1.000000 2.000000 INFINITY.X(3)4.000000 1.000000 1.500000 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 2 450.0000 150.0000 150.0000 3 300.0
19、000 150.0000 75.00000 当 A 的利润在【2.4,4.8】之间变化时,原最优生产计划不变。第三问:模型 MODEL:_1 MAX=3*X_1+X_2+4*X_3+3*X_4;_2 6*X_1+3*X_2+5*X_3+8*X_4=450;_3 3*X_1+4*X_2+5*X_3+2*X_4=300;END 编程 sets:is/1.2/:b;js/1.4/:c,x;links(is,js):a;endsets max=sum(js(J):c(J)*x(J);for(is(I):sum(js(J):a(I,J)*x(J)=b(I);data:c=3 1 4 3;b=450 30
20、0;a=6 3 5 8 3 4 5 2;end data End 最优解 Global optimal solution found.Objective value:275.0000 Infeasibilities:0.000000.Total solver iterations:2 Variable Value Reduced Cost B(1)450.0000 0.000000 B(2)300.0000 0.000000 C(1)3.000000 0.000000 C(2)1.000000 0.000000 C(3)4.000000 0.000000 C(4)3.000000 0.0000
21、00 X(1)0.000000 0.1000000 X(2)0.000000 1.966667 X(3)50.00000 0.000000 X(4)25.00000 0.000000 A(1,1)6.000000 0.000000 A(1,2)3.000000 0.000000 A(1,3)5.000000 0.000000 A(1,4)8.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)4.000000 0.000000 A(2,3)5.000000 0.000000 A(2,4)2.000000 0.000000 Row Slack or Sur
22、plus Dual Price 1 275.0000 1.000000 2 0.000000 0.2333333 3 0.000000 0.5666667 利润 275 元 值得生产。第四问 由单个价值系数和右端系数变化围的灵敏度分析结果 Ranges in which the basis is unchanged:Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X(1)3.000000 1.800000 0.6000000 X(2)1.000000
23、2.000000 INFINITY.X(3)4.000000 1.000000 1.500000 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 2 450.0000 150.0000 150.0000 3 300.0000 150.0000 75.00000 当购买 150 吨时 此时可买 360 元 在减去购买 150 吨的进价 60 元 此时可获利 300 超过了原计划,应该购买。第七题 模型 MODEL:_1 MAX=30*X_1+20*X_2+50*X_3;_2 X_1+2*X_2
24、+X_3=430;_3 3*X_1+2*X_3=410;_4 X_1+4*X_2=420;_5 X_1+X_2+X_3=70;_7 X_3=240;END 编程 sets:is/1.6/:b;js/1.3/:c,x;links(is,js):a;endsets max=sum(js(J):c(J)*x(J);sum(js(J):a(1,J)*x(J)=b(1);sum(js(J):a(2,J)*x(J)=b(2);sum(js(J):a(3,J)*x(J)=b(3);sum(js(J):a(4,J)*x(J)=B(5);sum(js(J):a(6,J)*x(J)=b(6);data:c=30
25、20 50;.b=430 410 420 300 70 240;a=1 2 1 3 0 2 1 4 0 1 1 1 0 1 0 0 0 1;end data end 最优解 Global optimal solution found.Objective value:12150.00 Infeasibilities:0.000000 Total solver iterations:4 Variable Value Reduced Cost B(1)430.0000 0.000000 B(2)410.0000 0.000000 B(3)420.0000 0.000000 B(4)300.0000
26、0.000000 B(5)70.00000 0.000000 B(6)240.0000 0.000000 C(1)30.00000 0.000000 C(2)20.00000 0.000000 C(3)50.00000 0.000000 X(1)0.000000 35.00000 X(2)95.00000 0.000000 X(3)205.0000 0.000000 A(1,1)1.000000 0.000000 A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)0.000000 0.00
27、0000 A(2,3)2.000000 0.000000.A(3,1)1.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.000000 0.000000 A(4,1)1.000000 0.000000 A(4,2)1.000000 0.000000 A(4,3)1.000000 0.000000 A(5,1)0.000000 0.000000 A(5,2)1.000000 0.000000 A(5,3)0.000000 0.000000 A(6,1)0.000000 0.000000 A(6,2)0.000000 0.000000 A(6,3)1
28、.000000 0.000000 Row Slack or Surplus Dual Price 1 12150.00 1.000000 2 35.00000 0.000000 3 0.000000 15.00000 4 40.00000 0.000000 5 0.000000 20.00000 6 25.00000 0.000000 7 35.00000 0.000000 最优解(0 95 205)最优值 12150 第一问 模型 MODEL:_1 MAX=30*X_1+20*X_2+60*X_3;_2 X_1+2*X_2+X_3=430;_3 3*X_1+2*X_3=410;_4 X_1+
29、4*X_2=420;_5 X_1+X_2+X_3=70;_7 X_3=190;END 编程.sets:is/1.6/:b;js/1.3/:c,x;links(is,js):a;endsets max=sum(js(J):c(J)*x(J);sum(js(J):a(1,J)*x(J)=b(1);sum(js(J):a(2,J)*x(J)=b(2);sum(js(J):a(3,J)*x(J)=b(3);sum(js(J):a(4,J)*x(J)=B(5);sum(js(J):a(6,J)*x(J)=b(6);data:c=30 20 60;b=430 410 420 300 70 190;a=1
30、2 1 3 0 2 1 4 0 1 1 1 0 1 0 0 0 1;end data end 最优解 Global optimal solution found.Objective value:13700.00 Infeasibilities:0.000000 Total solver iterations:4 Variable Value Reduced Cost B(1)430.0000 0.000000 B(2)410.0000 0.000000 B(3)420.0000 0.000000 B(4)300.0000 0.000000.B(5)70.00000 0.000000 B(6)1
31、90.0000 0.000000 C(1)30.00000 0.000000 C(2)20.00000 0.000000 C(3)60.00000 0.000000 X(1)10.00000 0.000000 X(2)100.0000 0.000000 X(3)190.0000 0.000000 A(1,1)1.000000 0.000000 A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)0.000000 0.000000 A(2,3)2.000000 0.000000 A(3,1)1
32、.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.000000 0.000000 A(4,1)1.000000 0.000000 A(4,2)1.000000 0.000000 A(4,3)1.000000 0.000000 A(5,1)0.000000 0.000000 A(5,2)1.000000 0.000000 A(5,3)0.000000 0.000000 A(6,1)0.000000 0.000000 A(6,2)0.000000 0.000000 A(6,3)1.000000 0.000000 Row Slack or Surplu
33、s Dual Price 1 13700.00 1.000000 2 30.00000 0.000000 3 0.000000 3.333333 4 10.00000 0.000000 5 0.000000 20.00000 6 30.00000 0.000000 7 0.000000 33.33333.最优解(10,100,190)最优值 13700;可行。第二问 由原问题的单个价值系数和右端系数变化围的灵敏度分析结果得 Ranges in which the basis is unchanged:Objective Coefficient Ranges Current Allowable
34、Allowable Variable Coefficient Increase Decrease X(1)30.00000 35.00000 INFINITY X(2)20.00000 30.00000 20.00000 X(3)50.00000 INFINITY 23.33333 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 2 430.0000 INFINITY 35.00000 3 410.0000 50.00000 20.00000 4 420.0000 INFINITY 40.0
35、0000 5 300.0000 10.00000 25.00000 6 70.00000 25.00000 INFINITY 7 240.0000 INFINITY 35.00000 当C2增加到310时 此时模型 MODEL:_1 MAX=30*X_1+20*X_2+50*X_3;_2 X_1+2*X_2+X_3=430;_3 3*X_1+2*X_3=410;_4 X_1+4*X_2=420;_5 X_1+X_2+X_3=70;_7 X_3=240;END 编程 sets:.is/1.6/:b;js/1.3/:c,x;links(is,js):a;endsets max=sum(js(J):
36、c(J)*x(J);sum(js(J):a(1,J)*x(J)=b(1);sum(js(J):a(2,J)*x(J)=b(2);sum(js(J):a(3,J)*x(J)=b(3);sum(js(J):a(4,J)*x(J)=B(5);sum(js(J):a(6,J)*x(J)=b(6);data:c=30 20 50;b=430 410 420 310 70 240;a=1 2 1 3 0 2 1 4 0 1 1 1 0 1 0 0 0 1;end data end 此时最优解 Global optimal solution found.Objective value:12350.00 In
37、feasibilities:0.000000 Total solver iterations:4 Variable Value Reduced Cost B(1)430.0000 0.000000 B(2)410.0000 0.000000 B(3)420.0000 0.000000 B(4)310.0000 0.000000 B(5)70.00000 0.000000.B(6)240.0000 0.000000 C(1)30.00000 0.000000 C(2)20.00000 0.000000 C(3)50.00000 0.000000 X(1)0.000000 50.00000 X(2
38、)105.0000 0.000000 X(3)205.0000 0.000000 A(1,1)1.000000 0.000000 A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)0.000000 0.000000 A(2,3)2.000000 0.000000 A(3,1)1.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.000000 0.000000 A(4,1)1.000000 0.000000 A(4,2)1.000000 0.00
39、0000 A(4,3)1.000000 0.000000 A(5,1)0.000000 0.000000 A(5,2)1.000000 0.000000 A(5,3)0.000000 0.000000 A(6,1)0.000000 0.000000 A(6,2)0.000000 0.000000 A(6,3)1.000000 0.000000 Row Slack or Surplus Dual Price 1 12350.00 1.000000 2 15.00000 0.000000 3 0.000000 25.00000 4 0.000000 5.000000 5 0.000000 0.00
40、0000 6 35.00000 0.000000 7 35.00000 0.000000 即(0,105,205)最优值为12350,此时的最优值减去增加的价格150,得到最终的利润12350-150=12200 可行。.第三问 模型 MODEL:_1 MAX=30*X_1+20*X_2+50*X_3;_2 X_1+2*X_2+X_3=470;_3 3*X_1+2*X_3=450;_4 X_1+4*X_2=420;_5 X_1+X_2+X_3=70;_7 X_3=240;END 编程 sets:is/1.6/:b;js/1.3/:c,x;links(is,js):a;endsets max=s
41、um(js(J):c(J)*x(J);sum(js(J):a(1,J)*x(J)=b(1);sum(js(J):a(2,J)*x(J)=b(2);sum(js(J):a(3,J)*x(J)=b(3);sum(js(J):a(4,J)*x(J)=B(5);sum(js(J):a(6,J)*x(J)=b(6);data:c=30 20 50;b=470 450 420 300 70 240;a=1 2 1 3 0 2 1 4 0 1 1 1 0 1 0 0 0 1;end data.end 最优解 Global optimal solution found.Objective value:1275
42、0.00 Infeasibilities:0.000000 Total solver iterations:4 Variable Value Reduced Cost B(1)470.0000 0.000000 B(2)450.0000 0.000000 B(3)420.0000 0.000000 B(4)300.0000 0.000000 B(5)70.00000 0.000000 B(6)240.0000 0.000000 C(1)30.00000 0.000000 C(2)20.00000 0.000000 C(3)50.00000 0.000000 X(1)0.000000 35.00
43、000 X(2)75.00000 0.000000 X(3)225.0000 0.000000 A(1,1)1.000000 0.000000 A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)0.000000 0.000000 A(2,3)2.000000 0.000000 A(3,1)1.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.000000 0.000000 A(4,1)1.000000 0.000000 A(4,2)1.0000
44、00 0.000000 A(4,3)1.000000 0.000000 A(5,1)0.000000 0.000000 A(5,2)1.000000 0.000000.A(5,3)0.000000 0.000000 A(6,1)0.000000 0.000000 A(6,2)0.000000 0.000000 A(6,3)1.000000 0.000000 Row Slack or Surplus Dual Price 1 12750.00 1.000000 2 95.00000 0.000000 3 0.000000 15.00000 4 120.0000 0.000000 5 0.0000
45、00 20.00000 6 5.000000 0.000000 7 15.00000 0.000000 此时最优解(0,75,225)最优值 12750 此时的最优值 12750-700=12050,即 12050 便是此时的利润,不可行 第四问 模型 MODEL:_1 MAX=30*X_1+20*X_2+50*X_3;_2 X_1+2*X_2+X_3=430;_3 3*X_1+2*X_3=410;_4 X_1+4*X_2=420;_5 X_1+X_2+X_3=300;_6 X_2=100;_7 X_3=240;END 编程 sets:is/1.6/:b;js/1.3/:c,x;links(i
46、s,js):a;endsets max=sum(js(J):c(J)*x(J);sum(js(J):a(1,J)*x(J)=b(1);sum(js(J):a(2,J)*x(J)=b(2);.sum(js(J):a(3,J)*x(J)=b(3);sum(js(J):a(4,J)*x(J)=b(4);sum(js(J):a(5,J)*x(J)=b(5);sum(js(J):a(6,J)*x(J)=b(6);data:c=30 20 50;b=430 410 420 300 100 240;a=1 2 1 3 0 2 1 4 0 1 1 1 0 1 0 0 0 1;end data end 最优解
47、Global optimal solution found.Objective value:12000.00 Infeasibilities:0.000000 Total solver iterations:2 Variable Value Reduced Cost B(1)430.0000 0.000000 B(2)410.0000 0.000000 B(3)420.0000 0.000000 B(4)300.0000 0.000000 B(5)100.0000 0.000000 B(6)240.0000 0.000000 C(1)30.00000 0.000000 C(2)20.00000
48、 0.000000 C(3)50.00000 0.000000 X(1)0.000000 20.00000 X(2)100.0000 0.000000 X(3)200.0000 0.000000.A(1,1)1.000000 0.000000 A(1,2)2.000000 0.000000 A(1,3)1.000000 0.000000 A(2,1)3.000000 0.000000 A(2,2)0.000000 0.000000 A(2,3)2.000000 0.000000 A(3,1)1.000000 0.000000 A(3,2)4.000000 0.000000 A(3,3)0.00
49、0000 0.000000 A(4,1)1.000000 0.000000 A(4,2)1.000000 0.000000 A(4,3)1.000000 0.000000 A(5,1)0.000000 0.000000 A(5,2)1.000000 0.000000 A(5,3)0.000000 0.000000 A(6,1)0.000000 0.000000 A(6,2)0.000000 0.000000 A(6,3)1.000000 0.000000 Row Slack or Surplus Dual Price 1 12000.00 1.000000 2 30.00000 0.00000
50、0 3 10.00000 0.000000 4 20.00000 0.000000 5 0.000000 50.00000 6 0.000000 -30.00000 7 40.00000 0.000000 即最优解(0,100,200)最优值 12000 不可行 第五问 模型 MODEL:_1 MAX=30*X_1+20*X_2+50*X_3;_2 X_1+2*X_2+X_3=430;_3 3*X_1+1.75*X_3=410;_4 X_1+4*X_2=420;._5 X_1+X_2+X_3=300;_6 X_2=70;_7 X_3=240;END 编程 sets:is/1.6/:b;js/1