资源描述:
《实验2整数规划》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、打开lingo求解下列线性规划maxZ=5xi+6为2,Xi+X2<6,5叭+9巧W45,九叼20,两严2为整数.3UNGO-UNGOModel-LINGO1FileEditLINGOWindowHelpD
2、a
3、E
4、到I凶剧T二I%l()l冒UNGOModel・UNGO1点File选new选笫五个,ok输入ffUNDOModel-UNGO2max5xl+6x2stxl+x2<=65xl+9x2<=45endgin2!2表示两个变量都取整数运行结果fyFileEditUNGOWindowHelpo
5、w旧
6、剑I-1・
7、二I4WsHol・I/1・
8、凶I同
9、创圃$
10、K
11、Globaloptimalsolutionfound.Objectivevalue:33.00000Extendedsolversteps:0Totalsolveriterations:0VariableValueReducedCostXI3.000000-5.000000X23.000000-6.000000RowSlackorSurplusDualPrice133.000001.00000020.0000000.00000033.0000000.000000练习1,求解线性规划模型maxZ=3xi++3①3、s.t.-xi+2念24
12、-C4,4血—3©3<2,的一如+2帀W3,Xi.X2.X3为非负整数<参考答案:max3xl+x2+3x3st-xl+2x2+x3<=44x2-3x3<=2xl-3x2+2x3<=3endgin3运行譽_____________Globaloptimalsolutionfound.Objectivevalue:23.00000Extendedsolversteps:0Totalsolveriterations:8VariableValueReducedCostXI5.000000-3.000000X22.000000-1.000000X32.00
13、0000-3.000000RowSlackorSurplusDualPrice123.000001.00000023.0000000.00000030.0000000.00000040.0000000.000000例题2,求解线性规划模型maxz=3xl+x2+3x3,S.t.-x1+2x2+x3v=4,4x2・3x3v=2,xl・3x2+2x3v=3,xl,x2,x3>=0且xl为整数输入9FileEditLINGOWin(0
14、胡曰
15、劉-爲
16、噩
17、亀
18、总
19、max3xl+x2+3x3Ist-xl+2x2+x3<=44x2-3x3<=2xl-3x2+2
20、x3<=3endginxl!表示xl取整数运行结果Globaloptimalsolutionfound.Objectivevalue:27.71429Extendedsolversteps:0Totalsolveriterations:4VariableValueReducedCostXI5.000000-3.857143X22.8571430.000000X33.2857140.000000RowSlackorSurplusDualPrice127.714291.00000020.0000001.57142930.42857140.0000004
21、0.0000000.7142857练习2求解下面线性规划模型maxZ=3«i+3切+13x3?s.t.+7a;3W&5為—3x2+7xsW&⑦iw&X2W5、<5,X.X2.X3》0,12卫3为整数.参考答案max3x1+3x2+13x3st—3xl+6x2+7x3<=85xl-3x2+7x3<=8xl<=5x2<=5x3<=5endginx2ginx3运算结果:Globaloptimalsolutionfound.Objectivevalue:19.20000Extendedsolversteps:0Totalsolveriterations:
22、4VariableValueReducedCostXI3.4000000.000000X23.000000-4.800000X30.000000-8.800000RowSlackorSurplusDualPrice119.200001.00000020.20000000.00000030.0000000.600000041.6000000.00000052.0000000.00000065.0000000.000000练习3求解卜•而线性规划模型(提示:考虑模型转化)maxZ=4xi+X2,s.t.5xi+丄2W13,2xi+©2W6)X20,◎
23、为非负偶整数.ir.ax4xl+x2st5xl+x2<=132xl+x2<=6x2-2x3=0endginx2ginx3i