欢迎来到天天文库
浏览记录
ID:34975378
大小:204.00 KB
页数:14页
时间:2019-03-15
《最优化方法(线性规划)—--用lingo对线性规划进行灵敏度的分析》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、...页眉lingo软件求解线性规划及灵敏度分析注:以目标函数最大化为例进行讨论,对求最小的问题,有类似的分析方法!所有程序运行环境为lingo10。一、用lingo软件求解线性规划例1:在模型窗口输入:model:max=2*x+3*y;4*x+3*y<=10;3*x+5*y<12;!theoptimalvalueis:7.454545;End如图所示:运行结果如下(点击工具栏上的‘solve’或点击菜单‘lingo’下的‘solve’即可):Globaloptimalsolutionfound.Objective
2、value:7.454545(最优解函数值)Infeasibilities:0.000000....页脚...页眉Totalsolveriterations:2(迭代次数)Variable(最优解)ValueReducedCostX1.2727270.000000Y1.6363640.000000RowSlackorSurplusDualPrice17.4545451.00000020.0000000.9090909E-0130.0000000.5454545例2:在模型窗口输入:model:max=5*x1+4*x
3、2;x1+3*x2+x3=90;2*x1+x2+x4=80;x1+x2+x5=45;end运行(solve)结果如下:Globaloptimalsolutionfound.Objectivevalue:215.0000Infeasibilities:0.000000Totalsolveriterations:3VariableValueReducedCostX135.000000.000000X210.000000.000000X325.000000.000000X40.0000001.000000X50.00000
4、03.000000RowSlackorSurplusDualPrice1215.00001.00000020.0000000.00000030.0000001.00000040.0000003.000000....页脚...页眉例3在模型窗口输入:model:min=-x2+2*x3;x1-2*x2+x3=2;x2-3*x3+x4=1;x2-x3+x5=2;end运行结果如下:Globaloptimalsolutionfound.Objectivevalue:-1.500000Infeasibilities:0.00
5、0000Totalsolveriterations:2VariableValueReducedCostX22.5000000.000000X30.50000000.000000X16.5000000.000000X40.0000000.5000000X50.0000000.5000000RowSlackorSurplusDualPrice1-1.500000-1.00000020.0000000.00000030.0000000.500000040.0000000.5000000例4:(非线性)在模型窗口输入:mod
6、el:min=@abs(x)+@abs(y)+@abs(z);x+y<=1;2*x+z=4;@free(x);....页脚...页眉@free(y);@free(z);End求解器状态如下:(可看出是非线性模型!)运行结果为:Linearizationcomponentsadded:Constraints:12Variables:12Integers:3Globaloptimalsolutionfound.Objectivevalue:(最优解函数值)3.000000Objectivebound:3.000000In
7、feasibilities:0.000000Extendedsolversteps:0Totalsolveriterations:3Variable(最优解)ValueReducedCostX2.0000000.000000Y-1.0000000.000000Z0.0000000.000000RowSlackorSurplusDualPrice13.000000-1.00000020.0000001.00000030.000000-1.000000二、用lingo软件进行灵敏度分析实例....页脚...页眉例5:在模
8、型窗口输入:Lingo模型:model:max=60*x+30*y+20*z;8*x+6*y+z<48;4*x+2*y+1.5*z<20;2*x+1.5*y+0.5*z<8;y<5;end(一)求解报告(solutionreport)通过菜单Lingo→Solve可以得到求解报告(solutionreport)如下:Globaloptimals
此文档下载收益归作者所有