lingo实验报告

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

......学习好帮手一、实验名称:推销员指派问题二、实验目的及任务:1、掌握Lingo软件的使用方法2、编写简单的Lingo程序3、解决Lingo中的最优指派问题三、实验内容1、问题描述一个公司要分派5个推销员去5个地区推销某种产品,5个推销员在各个地区推销这种产品的预期利润如下表所示。若每个推销员只能去一个地区。应如何分派这5个推销员才能使公司的利润为最大?2、模型建立决策变量:设个地区个人去第不指派第个地区个人去第指派第ji0ji1ijx(i,j=1,2,3,4,5)目标函数:设总利润为z,第i个人去第j个地区的利润为Aij(i,j=1,2,3,4,5),假设Aij为指派矩阵,则Max5151ijijijxAz约束条件:1.第j个地区只有一个人去:151iijx(j=1,2,3,4,5)2.第i个人只去一个地区:151jijx(i=1,2,3,4,5)由此得基本模型:......学习好帮手Max5151ijijijxAzS,t,151iijx(j=1,2,3,4,5)151jijx(i=1,2,3,4,5)10或ijx(i,j=1,2,3,4,5)3、Lingo程序(一)常规程序Lingo输入:model:max=1*x11+8*x12+9*x13+2*x14+1*x15+5*x21+6*x22+3*x23+10*x24+7*x25+3*x31+10*x32+4*x33+11*x34+3*x35+7*x41+7*x42+5*x43+4*x44+8*x45+4*x51+2*x52+6*x53+3*x54+9*x55;x11+x12+x13+x14+x15=1;x21+x22+x23+x24+x25=1;x31+x32+x33+x34+x35=1;x41+x42+x43+x44+x45=1;x51+x52+x53+x54+x55=1;x11+x21+x31+x41+x51=1;x12+x22+x32+x42+x52=1;x13+x23+x33+x43+x53=1;x14+x24+x34+x44+x54=1;x15+x25+x35+x45+x55=1;endLingo输出:Globaloptimalsolutionfound.Objectivevalue:45.00000Infeasibilities:0.000000Totalsolveriterations:8VariableValueReduced......学习好帮手CostX110.0000007.000000X120.0000000.000000X131.0000000.000000X140.0000007.000000X150.0000008.000000X210.0000004.000000X220.0000003.000000X230.0000007.000000X241.0000000.000000X250.0000003.000000X310.0000007.000000X321.0000000.000000X330.0000007.000000X340.0000000.000000X350.0000008.000000X411.0000000.000000X420.0000000.000000X430.0000003.000000X440.0000004.000000X450.0000000.000000X510.0000004.000000X520.000000......学习好帮手6.000000X530.0000003.000000X540.0000006.000000X551.0000000.000000RowSlackorSurplusDualPrice145.000001.00000020.0000009.00000030.00000010.0000040.00000011.0000050.0000008.00000060.0000009.00000070.000000-1.00000080.000000-1.00000090.0000000.000000100.0000000.000000110.0000000.000000(二)集合函数程序Lingo输入:model:sets:person/1..5/;area/1..5/;assign(person,area):A,x;endsetsdata:A=1,8,9,2,15,6,3,10,73,10,4,11,3......学习好帮手7,7,5,4,84,2,6,3,9;enddatamax=@sum(assign:A*x);@for(person(i):@sum(area(j):x(i,j))=1);@for(area(j):@sum(person(i):x(i,j))=1);@for(assign(i,j):@bin(x(i,j)));endLingo输出:Globaloptimalsolutionfound.Objectivevalue:45.00000Objectivebound:45.00000Infeasibilities:0.000000Extendedsolversteps:0Totalsolveriterations:0VariableValueReducedCostA(1,1)1.0000000.000000A(1,2)8.0000000.000000A(1,3)9.0000000.000000A(1,4)2.0000000.000000A(1,5)1.0000000.000000A(2,1)5.0000000.000000A(2,2)6.0000000.000000A(2,3)3.0000000.000000A(2,4)10.000000.000000A(2,5)7.0000000.000000A(3,1)3.0000000.000000A(3,2)10.000000.000000A(3,3)4.000000......学习好帮手0.000000A(3,4)11.000000.000000A(3,5)3.0000000.000000A(4,1)7.0000000.000000A(4,2)7.0000000.000000A(4,3)5.0000000.000000A(4,4)4.0000000.000000A(4,5)8.0000000.000000A(5,1)4.0000000.000000A(5,2)2.0000000.000000A(5,3)6.0000000.000000A(5,4)3.0000000.000000A(5,5)9.0000000.000000X(1,1)0.000000-1.000000X(1,2)0.000000-8.000000X(1,3)1.000000-9.000000X(1,4)0.000000-2.000000X(1,5)0.000000-1.000000X(2,1)0.000000-5.000000X(2,2)0.000000-6.000000X(2,3)0.000000-3.000000X(2,4)1.000000-10.00000X(2,5)0.000000......学习好帮手-7.000000X(3,1)0.000000-3.000000X(3,2)1.000000-10.00000X(3,3)0.000000-4.000000X(3,4)0.000000-11.00000X(3,5)0.000000-3.000000X(4,1)1.000000-7.000000X(4,2)0.000000-7.000000X(4,3)0.000000-5.000000X(4,4)0.000000-4.000000X(4,5)0.000000-8.000000X(5,1)0.000000-4.000000X(5,2)0.000000-2.000000X(5,3)0.000000-6.000000X(5,4)0.000000-3.000000X(5,5)1.000000-9.000000RowSlackorSurplusDualPrice145.000001.00000020.0000000.00000030.0000000.00000040.0000000.00000050.0000000.00000060.000000......学习好帮手0.00000070.0000000.00000080.0000000.00000090.0000000.000000100.0000000.000000110.0000000.0000004、求解结果通过上面的lingo程序求解,得出结论:甲去C地区,乙去D地区,丙去B地区,丁去A地区,茂去E地区,此时公司的利润最大。四、实验总结在该实验中,我对lingo软件有了一些基本的了解,学会了用lingo软件求解指派问题的方法,并且能运用部分集合函数编写一些简单的程序。宁可累死在路上,也不能闲死在家里!宁可去碰壁,也不能面壁。是狼就要练好牙,是羊就要练好腿。什么是奋斗?奋斗就是每天很难,可一年一年却越来越容易。不奋斗就是每天都很容易,可一年一年越来越难。能干的人,不在情绪上计较,只在做事上认真;无能的人!不在做事上认真,只在情绪上计较。拼一个春夏秋冬!赢一个无悔人生!早安!—————献给所有努力的人.

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功