《线性规划地灵敏度分析报告实验报告材料.doc》由会员分享,可在线阅读,更多相关《线性规划地灵敏度分析报告实验报告材料.doc(29页珍藏版)》请在课桌文档上搜索。
1、word运筹学/线性规划实验报告实验室: 实验日期:实验项目线性规划的灵敏度分析系 别数学系姓 名学 号班 级指导教师成 绩一 实验目的掌握用Lingo/Lindo对线性规划问题进展灵敏度分析的方法,理解解报告的容。初步掌握对实际的线性规划问题建立数学模型,并利用计算机求解分析的一般方法。二 实验环境Lingo软件三 实验容包括数学模型、上机程序、实验结果、结果分析与问题解答等例题2-10MODEL: _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
2、 = 12 ;END编程sets:is/1.3/:b;js/1.5/:c,x;links(is,js):a;endsetsmax=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;enddataend灵敏度分析 Ranges in which the basis is unchanged:Objective Coefficient Ranges Current Allowable Allowable Variabl
3、e Coefficient Increase Decrease X( 3) 0.0 1.500000 INFINITY X( 4) 0.0 0.1250000 INFINITYRighthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease当b2在8,32之间变化时 最优基不变最优解 Global optimal solution found at iteration: 0Variable Value Reduced CostRow Slack or Surplus Dual Price例题2-11模型MAX
4、 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;endsetsmax=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;enddataend最优解 Glob
5、al optimal solution found at iteration: 2Variable Value Reduced Cost Row Slack or Surplus Dual Price最优解4,3,2,0,0最优值z=17分析 Ranges in which the basis is unchanged: Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X( 3) 0.0 1.500000 INFINITY X( 4) 0.0 0.50
6、00000 INFINITY X( 5) 0.0 0.7500000 INFINITY Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease例题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;endsetsmax=sum(js
7、(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;enddataend灵敏度分析Ranges in which the basis is unchanged: Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X( 3) 0.0 1.500000 INFINITY X( 4) 0.0 0
8、.1250000 INFINITYRighthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease由灵敏度分析表知道C2在【0,4】之间变化时,最优基不变。第六题模型MODEL: _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;endsetsma
9、x=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;enddataEnd最优解 Global optimal solution found. Total solver iterations: 2Variable Value Reduced Cost Row Slack or Surplus Dual Price第一问:A生产50 B生产0 C生产30 有最高利润270元;第二问:单个价值系数和右端系数变化围的灵敏度分析结果Ranges in which t
10、he basis is unchanged: Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X( 2) 1.000000 2.000000 INFINITY Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease当A的利润在【2.4,4.8】之间变化时,原最优生产计划不变。第三问:模型MODEL: _1 MAX= 3 * X_1 + X_2 + 4 * X
11、_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;endsetsmax=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;enddataEnd最优解 Global optimal s
12、olution found. Total solver iterations: 2 Variable Value Reduced Cost Row Slack or Surplus Dual Price利润275元 值得生产。第四问由单个价值系数和右端系数变化围的灵敏度分析结果Ranges in which the basis is unchanged: Objective Coefficient Ranges Current Allowable Allowable Variable Coefficient Increase Decrease X( 2) 1.000000 2.000000 I
13、NFINITY Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease当购置150吨时 此时可买360元 在减去购置150吨的进价60元 此时可获利300超过了原计划,应该购置。第七题模型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 ;
14、 _7 X_3 = 240 ;END编程sets:is/1.6/:b;js/1.3/:c,x;links(is,js):a;endsetsmax=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 50;b=430 410 420 300 70 240;a=1 2 1 3 0 2 1 4 0 1 1 1 0 1 0
15、 0 0 1;enddataend最优解 Global optimal solution found. Total solver iterations: 4 Variable Value Reduced Cost Row Slack or Surplus Dual Price最优解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 + 4 * X_2 = 420 ; _5 X_
16、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;endsetsmax=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 2 1 3 0
17、 2 1 4 0 1 1 1 0 1 0 0 0 1;enddataend最优解Global optimal solution found. Total solver iterations: 4 Variable Value Reduced Cost Row Slack or Surplus Dual Price最优解10,100,190最优值13700;可行。第二问由原问题的单个价值系数和右端系数变化围的灵敏度分析结果得Ranges in which the basis is unchanged: Objective Coefficient Ranges Current Allowable
18、Allowable Variable Coefficient Increase Decrease X( 1) 30.00000 35.00000 INFINITY Righthand Side Ranges Row Current Allowable Allowable RHS Increase Decrease 6 70.00000 25.00000 INFINITY当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
19、 = 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;endsetsmax=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
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;enddataend此时最优解 Global optimal solution found. Total solver iterations: 4 Variable Value Reduced Cost Row Slack or Surplus Dual Price即0,105,205最优值为12350,此时的最优值减去增加的价格150,得到最终的利润12350-150=12200 可行。第三问模型MODEL: _1 MAX= 30 * X_1 + 20 * X_
21、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;endsetsmax=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);s
22、um(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;enddataend最优解 Global optimal solution found. Total solver iterations: 4 Variable Value Reduced Cost Row Slack or Surplus Dual Price此时最优解0,75,225最优值12750 此时的最优值12750-700
23、=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(is,js):a;endsetsmax=sum(js(J):c(J)*x(J);sum(
24、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;enddataend最优解 Global optimal solution found. Total solver iter
25、ations: 2 Variable Value Reduced Cost Row Slack or Surplus Dual Price即最优解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:
26、is/1.6/:b;js/1.3/:c,x;links(is,js):a;endsetsmax=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 70 240;a=1 2 1 1 4 0 1 1 1 0 1 0 0 0 1;enddataend最优解 Global optimal solution found. Total solver iterations: 2 Variable Value Reduced Cost Row Slack or Surplus Dual Price即最优解0,70,230此时最优值12900,减去每天支出40,12900-40=1286012860为此时利润,方案可行。实验小结29 / 29