资源描述:
《lingo实验报告》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、一、实验名称:推销员指派问题二、实验目的及任务:1、掌握Lingo软件的使用方法2、编写简单的Lingo程序3、解决Lingo中的最优指派问题三、实验内容1、问题描述一个公司要分派5个推销员去5个地区推销某种产品,5个推销员在各个地区推销这种产品的预期利润如下表所示。若每个推销员只能去一个地区。应如何分派这5个推销员才能使公司的利润为最大?2、模型建立决策变量:设(i,j=1,2,3,4,5)目标函数:设总利润为z,第i个人去第j个地区的利润为Aij(i,j=1,2,3,4,5),假设Aij为指派矩阵,则Max
2、约束条件:1.第j个地区只有一个人去:(j=1,2,3,4,5)2.第i个人只去一个地区:(i=1,2,3,4,5)由此得基本模型:MaxS,t,(j=1,2,3,4,5)(i=1,2,3,4,5)(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
3、+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+x
4、55=1;endLingo输出:Globaloptimalsolutionfound.Objectivevalue:45.00000Infeasibilities:0.000000Totalsolveriterations:8VariableValueReducedCostX110.0000007.000000X120.0000000.000000X131.0000000.000000X140.0000007.000000X150.0000008.000000X210.0000004.000000X220.00
5、00003.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.00000
6、0X510.0000004.000000X520.0000006.000000X530.0000003.000000X540.0000006.000000X551.0000000.000000RowSlackorSurplusDualPrice145.000001.00000020.0000009.00000030.00000010.0000040.00000011.0000050.0000008.00000060.0000009.00000070.000000-1.00000080.000000-1.0000
7、0090.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,37,7,5,4,84,2,6,3,9;enddatamax=@sum(assign:A*x);@for(person(i):@sum(area(j):x(i,j))=
8、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.000000Extendedsolve