1、《运筹学/线性规划》实验报告 实验室: 实验日期: 实验项目 线性规划的灵敏度分析 系 别 数学系 姓 名 学 号 班 级 指导教师 成 绩 一 实验目的 掌握用Lingo/Lindo对线性规划问题进行灵敏度分析的方法,理解解报告的内容。初步掌握对实际的线性规划问题建立数学模型,并运用计算机求解分析的一般方法。 二 实验环境 Lingo软件 三 实验内容(涉及数学模型、上机程序、实验结果、结果分析与问题解答等) 例题2-10 MODEL: [_1]
2、 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: 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=
3、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
4、 Variable Coefficient Increase Decrease X( 1) 2.000000 INFINITY 0.5000000 X( 2) 3.000000 1.000000 3.000000 X( 3) 0.0 1.500000 INFINITY
5、 X( 4) 0.0 0.1250000 INFINITY X( 5) 0.0 0.7500000 0.2500000 Righthand Side Ranges Row Current Allowable Allowable RHS
6、 Increase Decrease 2 8.000000 2.000000 4.000000 3 16.00000 16.00000 8.000000 4 12.00000 INFINITY 4.000000 当b2在 [8,32]之间变化时 最优基不变 最优解 Gl
7、obal 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
8、 B( 3) 12.00000 0.000000 C( 1) 2.000000 0.000000 C( 2) 3.000000 0.000000 C( 3) 0.000000 0.000000
9、 C( 4) 0.000000 0.000000 C( 5) 0.000000 0.000000 X( 1) 4.000000 0.000000 X( 2) 2.000000 0.000000 X( 3) 0.00000
10、0 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
11、 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,
12、 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
13、 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、 14.00000 1.000000 2 0.000000 1.500000 3 0.000000 0.1250000 4 0.000000 0.000000 例题2-11 模型 MAX 2 X( 1) + 3 X( 2) SUBJECT TO 2]
15、 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
16、 0 4 0 0 1; end data end 最优解 Global optimal solution found at iteration: 2 Objective value: 17.00000 Variable Value Reduced Cost B( 1) 12.00000 0.000000
17、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
18、 0.000000 C( 4) 0.000000 0.000000 C( 5) 0.000000 0.000000 X( 1) 4.000000 0.000000 X( 2) 3.000000 0.000000
19、 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
20、 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
21、 A( 2, 2) 0.000000 0.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
22、 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
23、 Row Slack or Surplus Dual Price 1 17.00000 1.000000 2 0.000000 0.000000 3 0.000000 0.5000000 4
24、 0.000000 0.7500000 最优解(4,3,2,0,0)最优值z=17 分析 Ranges in which the basis is unchanged: Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient
25、 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)
26、 0.0 0.5000000 INFINITY X( 5) 0.0 0.7500000 INFINITY Righthand Side Ranges Row Current Allowable Allowable
27、 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) +
28、 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)); @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
29、 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 Inc
30、rease 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
31、 0.1250000 INFINITY X( 5) 0.0 0.7500000 0.2500000 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease
32、 2 8.000000 2.000000 4.000000 3 16.00000 16.00000 8.000000 4 12.00000 INFINITY 4.000000 由灵敏度分析表知道C2在【0,4】之间变化时,最优基不变。 第六题 模型 MODEL: [_1] MAX= 3 * X_1 + X_2 + 4
33、 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 d
34、ata End 最优解 Global optimal solution found. Objective value: 270.0000 Infeasibilities: 0.000000 Total solver iterations: 2 Variable Value Reduced Cost B( 1)
35、 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
36、 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
37、 A( 1, 2) 3.000000 0.000000 A( 1, 3) 5.000000 0.000000 A( 2, 1) 3.000000 0.000000 A( 2, 2) 4.000000 0.000000 A( 2, 3)
38、 5.000000 0.000000 Row Slack or Surplus Dual Price 1 270.0000 1.000000 2 0.000000 0.2023000 3 0.000000
39、 0.6000000 第一问: A生产50 B生产0 C生产30 有最高利润270元; 第二问: 单个价值系数和右端系数变化范围的灵敏度分析结果 Ranges in which the basis is unchanged: Objective Coefficient Ranges Current Allowable Allowable Variable C
40、oefficient 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
41、 Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 2 450.0000 150.0000 150.0000 3
42、 300.0000 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/
43、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 300; a=6 3 5 8 3 4 5 2; end data End 最优解 Global optimal solution found. Objective value: 275.0000 Infeasibilities:
44、 0.000000 Total solver iterations: 2 Variable Value Reduced Cost B( 1) 450.0000 0.000000 B( 2) 300.0000 0.00000
45、0 C( 1) 3.000000 0.000000 C( 2) 1.000000 0.000000 C( 3) 4.000000 0.000000 C( 4) 3.000000 0.000000
46、 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.0000
47、00 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
48、 A( 2, 2) 4.000000 0.000000 A( 2, 3) 5.000000 0.000000 A( 2, 4) 2.000000 0.000000 Row Slack or Surplus Dual Price
49、 1 275.0000 1.000000 2 0.000000 0.2333333 3 0.000000 0.5666667 利润275元 值得生产。 第四问 由单个价值系数和右端系数变化范围的灵敏度分析结果 Ranges in which the basis is unchanged:
50、 Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X( 1) 3.000000 1.800000 0.6000000 X( 2)






