最优化方法——用Lingo对线性规划进行灵敏度分析_第1页
最优化方法——用Lingo对线性规划进行灵敏度分析_第2页
最优化方法——用Lingo对线性规划进行灵敏度分析_第3页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、最优化方法一一用Lingo对线性规划进行灵敏度分析lingo软件求解线性规划及灵敬度分析注:以U标函数最大化为例进行讨论,对求最小的问题,有类似的分析方法?所有程序运行环境为lingolOo一、用1込曲软件求解线性规划例:max23zxy,stxy. 4310, , 3512xy,xy, 0,在模型窗口输入:model:max=2*x+3*y;4*x+3*yv=10;3*x+5*y<12;! the optimal value is :7 ? 454545 ; End如下图:二空-v e- ?D<| ? r- i 严? ? ? '丨?-modGI:, -P ;3*z-t J

2、>*y<12;B?jid"solve'即可:Global optimal solution found.Objective value: 7. 454545 最优解函数值Total solver iterations: 2 迭代次数road, are the structural road traffic within the city ? In addition, suitable for high speed, and high-speed, S206, S307, also serve inner- city traffic ? Outbound traff

3、ic : existing highways suitable for highspeed, and high speed, darts S206, S307 and Yi wei road, and so on.After years of constant development, road conditions have been greatlyVariable 最优解 Value Reduced CostX 1. 272727 0. 000000Y 1. 636364 0. 000000Row Slack or Surplus Dual Price1 7. 4545451. 00000

4、02 0. 0000000. 9090909E-013 0. 0000000. 5454545 例max54zxx,12stxxx. ? 390, ,123280xxx, , ,124xxx, , ,45125x, 0 在模型窗口输入model:max=5*xl+4*x2xl+3*x2+x3 二 902*xl+x2+x4 二 80xl+x2+x5=45;end运行(solve)结果如下:Global optimal solution found.Objective value: 215. 0000Total solver iterations: 3Variable Value Reduced

5、CostXI 35. 00000 0. 000000X2 10. 00000 0. 000000X3 25. 00000 0. 000000X4 0. 000000 1.000000X5 0. 000000 3. 000000Row Slack or Surplus Dual Price1 215. 0000 1.0000002 0. 000000 0. 0000003 0. 000000 1.0000004 0. 000000 3. 000000例3conditions have been greatly speed, and high speed), darts (S206, S307)

6、and Yi wei road, and soon. After years of constant development, road-city traffic ? Outbound traffic: existing highways (suitable for high-speed, S206, S307, also serve inner-ion, suitable for high speed, and highroad, are the structural road traffic within the city ? In addit2min2zxx, 23stxxx. 22,

7、, , 123 xxx, , ,31234 xxx, , , 2235 x, 0 在模型窗口输入: model: min=-x2+2*x3; xl-2*x2+x3 二 2; x2-3*x3+x4 二 1; x2-x3+x5=2; end 运行结果如下: Global optimal solution found ? Objective value: -1. 500000 Total solver iterations: 2 Variable Value Reduced Cost X2 2.500000 0.000000 X3 0.5000000 0.000000 XI 6.500000 0.0

8、00000 X4 0.000000 0.5000000 X5 0.000000 0.5000000 Row Slack or Surplus Dual Price 1 -1. 500000 -1. 000000 2 0. 000000 0. 000000 3 0. 000000 0. 5000000 4 0. 000000 0. 5000000 例 4:minxyz, ,stxy.? 1,24xz,在模型窗口输入:model:min=abs(x)+abs(y)+abs(z);x+y<l;2*x+z=4;?free(x);?free(y);?free (z);greatly nd high

9、 speed), darts (S206, S307) and Yi wei road, and soon. After years of constant development, road conditions have beenspeed, a-city traffic ? Outbound traffic : existing highways (suitable for highspeed, S206, S307, also serve inner-road, are the structural road traffic within the city ? In addition,

10、 suitable for high speed, and high3End求解器状态如下: 可看出是非线性模型 ? Solver StatusM皿LIIPStateGlobal Ont)j ?cti v<30jr&ti ons0Extezxde-d SolverStatusSolverBand-BOBj Bou nd僵3Steps0Active0VariablesoZ15?r>0血3Con stra intsotd15&nlin? 4r:0Kon rtrosotal:37anl me"0Gen ?r at or Memory U"

11、d (K)18Elapsed Run time thh: njs: ss)00:00:00运行结果为:Linearization components added :Constraints: 12Variables: 12Integers: 3Global optimal solution found.Objective value: 3. 000000Extended solver steps: 0Total solver iterations: 4Variable Value Reduced CostX 2. 000000 0. 000000丫 -1.000000 0. 000000Row

12、 Slack or Surplus Dual Price1 3. 000000 -1. 0000002 0. 000000 1. 0000003 0.000000 -1. 000000二、用 ling 。软件进行灵敬度分析实例例 5:conditions have been greatly speed, and high speed), darts (S206,S307) and Yi wei road, and so on. After years of constant development, road-city traffic ? Outbound traffic: existing

13、highways (suitable for high-speed, S206, S307, also serve inner-ion, suitable for high speed, and highroad, are the structural road traffic within the city ? In addit4 max603020Sxyz, 8648xyz,421.520xyz, , , 21.50.58xyz,y,5xyz, 0,在模型窗口输入:Lingo 模型:model:max=60*x+30*y+20*z;8*x+6*y+z<48;4*x+2*y+l. 5*

14、z<20;2*x+l. 5*y+0. 5*z<8;y<5;end( 一 ) 求解报告 (solution report)通过菜单 Lingo?Solve 可以得到求解报告 (solution report) 如下 :Global optimal solution found at iteration: 0Objective value: 280.0000Variable Value Reduced CostX 2. 000000 0. 000000Y 0. 000000 5. 000000Z 8. 000000 0. 000000Row Slack or Surplus Du

15、al Price1 280. 0000 1. 0000002 24. 00000 0. 0000003 0. 000000 10. 000004 0. 000000 10. 000005 5. 000000 0. 000000分析 Value, Reduced Cost, Slack or Surplus, Dual Price 的意义如下: 1、 最优解和基变 量确实定Value 所在列给出了问题的最优解。曲于基变量取值非零,因此 Value 所在列取值非零的决策变量 x, z 是基变量。2、差额本钱Reduced Cost (或 opportunity cost) 所在列的三个数值表示肖决

16、策变量取值增加一个单位时,日标函数值的减少量。例如:第 2个数 5表示当变量 y 增加一个单 位时,最优 LI标函数值减少的量。例如:当y二1时,最优LI标函数值为280- 5二275。可通过如下模型可检验:model:max=60*x+30*y+20*z;4*x+2*y+l. 5*z<20;greatly nd high speed), darts (S206, S307) and Yi wei road, and soon. After years of constant development, road conditions have beenspeed, a-city traf

17、fic ? Outbound traffic : existing highways (suitable for highspeed, S206, S307, also serve inner-road, are the structural road traffic within the city ? In addition, suitable for high speed, and high5 2*x+l. 5*y+0. 5*z<8;y<5;y 二 1;end注:( 1)换一个角度说,就是目标函数中变量y 的系数增加 5,那么生产 y 才会 有利?(2)基变量的Reduced

18、Cost值为0,只有非基变量的 Reduced Cost值才可能不 为0;故ill value,和Reduced Cost值分析可知y为非基变量。、松弛变量取值 3Slack or Surplus所在列的各数表示各行的松弛变量的取值。标函数行的Slack or Surplus值没啥意义,不用考虑。可通过如下模型检验:model:max=60*x+30*y+20*z;8*x+6*y+z+sl=48;4*x+2*y+l. 5*z+s2=20;y+s4=5;end4、对偶价格影子价格Dual Price 所在列的各数表示相应约束条件的右端常数增加一个单位时,最优 口标 函数值的增加量。注,只有紧约束

19、行的 Dual Price 值不为 0。例如 : 要检验第二行约 束,可 通过如下模型:model:max=60*x+30*y+20*z;8*x+6*y+z<48;4*x+2*y+l. 5*z<21;2*x+l. 5*y+0. 5*z<8;y<5;end二灵敏度分析报告首先设置 : Lingo?Options?General solver?Dual computations?Prices andRangeo当求解完成后,最小化求解报告窗口,然后点击菜单Lingo?Range, 可得灵敏 度分析报告:Ranges in which the basis is unchang

20、ed:Objective Coefficient RangesCurrent Allowable AllowableVariable Coefficient Increase DecreaseX 60. 00000 20. 00000 4. 000000Y 30. 00000 5. 000000 INFINITYZ 20. 00000 2. 500000 5. 000000Righthand Side RangesRow Current Allowable AllowableRHS Increase Decrease24.0000048.00000INFINITY20. 000004.0000

21、004.000000& 0000002. 0000001. 3333335. 000000INFINITY5. 000000 分析 Objective Coefficient Ranges,Righthand Side Ranges 的意义如下 :1、 LI 标函数中系数的变化对最优基的影响conditions have been greatly speed, and high speed), darts (S206,S307) and Yi wei road, and so on. After years of constant development, road-city traf

22、fic ? Outbound traffic: existing highways (suitable for high-speed, S206, S307, also serve inner-ion, suitable for high speed, and highroad, are the structural road traffic within the city ? In addit6Objective Coefficient Ranges 表示忖标函数行各系数在某个范圉内变化时, 最优基保持不变。以变量 X 的系数为例:当 X 的系数在内取值时,最优 6046020,基保持不变。

23、此时,最优解不变,最优H 标函数值变了。例如 : 可通过如下模 型检验:model:max=56. 0001*x+30*y+20*z;8*x+6*y+z<48;4*x+2*y+l. 5*z<20;2*x+l. 5*y+0. 5*z<8;y<5;end2、约束条件右端常数变化对最优基的影响Righthand Side Ranges 表示约束右端项各数在某个范围内变化时,最优基保 以笫一个约束行为例:当右端项在内取值时,最优基保持不变。482448,此时,最优解, LI 标函数的最优值变化了。例如 : 可通过如下模型检验:model:max=60*x+30*y+20*z;8

24、*x+6*y+z<4800;4*x+2*y+l. 5*z<20;2*x+l. 5*y+0. 5*z<8;y<5;end注:关于 ling 。软件的更广泛的应用见相关参考书或者ling 。软件的帮助文档常用约束函数持不变。? lingo定义 x 为 0-1 变量 bin(x)定义x为整数变量gin(x)X无限制(lingo模型里面,变量被默认为非负,即任意变量 x>=0) free(x)?bnd (a, x, b) A<x<b练习:1、建立线性规划模型并求解ltl0t5tAB(l)某工厂生产甲、乙两种产品。生产甲种产品需耗种矿石、种矿石、4tlt4t4t

25、9tlt600AB煤;生产乙种产品需耗种矿石、种矿石、煤。每甲种产品的利润是ltlOOOA元,每乙种产品的利润是元。工厂在生产这两种产品的方案中要求消 耗种 矿石不300t200t360tB超过、种矿石不超过、煤不超过。甲、乙两种产品应各生产多少,能使利润总额到达最大,(2)设有A, A两个香蕉基地,产量分别为 60吨和80吨,联合供给B, B, B三 个销 地12123的销售量经预测分别为 50吨、50吨和40吨。两个产地到三个销地 的单位运价 如下表所示:表1(单位运费:元/吨)Br3砂400八400八3Q2greatly nd high speed), darts (S206, S307

26、) and Yi wei road, and so on. After years of constant development, road conditions have beenspeed, a-city traffic. Outbound traffic : existing highways (suitable for highand high7现有原料数量及每种speed, S206, S307, also serve inner-road, are the structural roadtraffic within the city ? In addition, suitable for high speed, 问每个产地向每个销地 各发货多少,才能使总的运费最少,2、 用 Lingo 软件对以下线性规划问题进行灵敏度分析。(1)min33, , xxxl23stxxx ? 25, ,1232316xxx, , 123xx, ,1212xxx, 0, 123(2)max2xx, 12stxxx ? 5, , ,123八, xxxO 1246221xxx, , ,125xx, 0? , 15(3)max30354045xxxx, , , 1234stxxxx.346470, , , ,1234 436580xxxx,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论