-1-一、投资计划问题某地区在今后3年内有4种投资机会,第一种是在3年内每年年初投资,年底可获利润20%,并可将本金收回。第二种是在第一年年初投资,第二年年底可获利50%,并可将本金收回,但该项投资金额不超过2百万元。第三种是在第二年年初投资,第三年年底收回本金,并获利60%,但该项投资金额不超过1.5百万元。第四种是在第三年年初投资,第三年年底收回本金,并可获利40%,但该项投资金额不超过1百万元。现在该地区准备了3百万元资金,如何制定投资方案,使到第三年年末本利的和最大?解:解:设x1,x2,x3,x4依次表示从一种投资方案到第四种投资方案的投资额输入模型:max=x1*1.2+x2*1.5+(x1+x3)*1.2+x4*1.6+(x1+x3+x5)*1.2+x6*1.4;x1+x2+x3+x4+x5+x5+x6=3;x22;x41.5;x61;end计算结果如下:-2-Globaloptimalsolutionfound.Objectivevalue:10.80000Totalsolveriterations:0VariableValueReducedCostX13.0000000.000000X20.0000002.100000X30.0000001.200000X40.0000002.000000X50.0000006.000000X60.0000002.200000RowSlackorSurplusDualPrice110.800001.00000020.0000003.60000032.0000000.00000041.5000000.00000051.0000000.000000本利和最大为10.80000二、配料问题-3-某冶炼厂计划炼制含甲、乙、丙、丁4种金属成分的合金1吨,4种金属的含量比例为:甲不少于23%,乙不多于15%,丙不多于4%,丁介于35%~65%之间,此外不允许有其他成分。该厂准备用6种不同等级的矿石熔炼这种合金,各种矿石中的杂质在熔炼中废弃。现将每种矿石中的4种金属含量和价格列表如下,试计算如何选配各种矿石才能使合金的原料成本达到最低。金属含量和价格矿石品种金属甲金属乙金属丙金属丁矿石含金属(%)矿石含杂质(%)矿石价格(元/吨)矿石10.250.100.100.250.700.3023矿石20.400.000.000.300.700.3020矿石30.200.100.000.300.600.4018矿石40.000.150.050.200.400.6010矿石50.200.200.000.400.800.2027矿石60.080.050.100.170.400.6012解:设x1,x2,x3,x4,x5,x6依次表示矿石1到矿石6所需的用量程序如下:min=23*x1+20*x2+18*x3+10*x4+27*x5+12*x6;0.25*x1+0.4*x2+0.2*x3+0.2*x5+0.08*x60.23;0.1*x1+0.1*x3+0.15*x4+0.2*x5+0.05*x60.15;0.1*x1+0.05*x4+0.1*x60.04;0.25*x1+0.3*x2+0.3*x3+0.2*x4+0.4*x5+0.17*x60.35;0.25*x1+0.3*x2+0.3*x3+0.2*x4+0.4*x5+0.17*x60.65;0.25*x1+0.4*x2+0.2*x3+0.2*x5+0.08*x6+0.1*x1+0.1*x3+0.15*x4+0.2*x5+0.05*x6+0.1*x1+0.05*x4+0.1*x6+0.25*x1+0.3*x2+0.3*x3+0.2*x4+0.4*x5+0.17*x6=1;End结果如下:-4-Globaloptimalsolutionfound.Objectivevalue:27.42857Totalsolveriterations:1VariableValueReducedCostX10.0000005.857143X20.97142860.000000X30.0000000.8571429X40.80000000.000000X50.0000004.142857X60.0000003.428571RowSlackorSurplusDualPrice127.42857-1.00000020.15857140.00000030.3000000E-010.00000040.00000028.5714350.10142860.00000060.19857140.00000070.000000-28.57143解得最低成本为27.42857最优解X2=0.971429,X4=0.8-5-三、下料问题有一批500cm长的条材,要截成98cm长的毛坯1000根、78cm长的毛坯2000根。现有6种下料方法,每种方法截出两种毛坯的根数和残料的长度列表如下,要求计算如何下料可使所用条材根数最少。6种下料方法比较下料方法98cm毛坯根数78cm毛坯根数残料(cm)方法15010方法24130方法33260方法42370方法51512方法60632解:设x1为方法1所用的条材根数,x2为方法2所用的条材根数,x3为方法3所用的条材根数,x4为方法4所用的条材根数,x5为方法5所用的条材根数,x6为方法6所用的条材根数输入程序:min=x1+x2+x3+x4+x5+x6;5*x1+4*x2+3*x3+2*x4+x5=1000;x2+2*x3+3*x4+5*x5+6*x6=2000;end结果如下:-6-Globaloptimalsolutionfound.Objectivevalue:520.0000Totalsolveriterations:0VariableValueReducedCostX1120.00000.000000X20.0000000.4000000E-01X30.0000000.8000000E-01X40.0000000.1200000X5400.00000.000000X60.0000000.4000000E-01RowSlackorSurplusDualPrice1520.0000-1.00000020.000000-0.200000030.000000-0.1600000解得:用掉条材根数最少为520最优解x1=120,x5=400四、资源分配问题某个中型的百货商场对售货人员的需求经过统计分析如下表所示。-7-时间所需售货员人数星期日28人星期一15人星期二24人星期三25人星期四19人星期五31人星期六28人为了保证销售人员充分休息,售货人员每周工作五天,工作的五天连续。休息两天,并要求休息的两天是连续的。问应该如何安排售货人员的作息,既能满足工作需要,又使配备的售货人员的人数最少?解:x1,x2,x3,x4,x5,x6,x7依次表示每天安排的售货员人数sets:days/x1..x7/:required,start;endsetsdata:required=15242519312828;enddatamin=@sum(days:start);@for(days(j):@sum(days(i)|i#le#5:start(@wrap(j+i+2,7)))=required(j));end结果如下:-8-Globaloptimalsolutionfound.Objectivevalue:36.00000Totalsolveriterations:11VariableValueReducedCostREQUIRED(X1)15.000000.000000REQUIRED(X2)24.000000.000000REQUIRED(X3)25.000000.000000REQUIRED(X4)19.000000.000000REQUIRED(X5)31.000000.000000REQUIRED(X6)28.000000.000000REQUIRED(X7)28.000000.000000START(X1)3.0000000.000000START(X2)5.0000000.000000START(X3)12.000000.000000START(X4)0.0000000.3333333START(X5)11.000000.000000START(X6)0.0000000.000000START(X7)5.0000000.000000RowSlackorSurplusDualPrice136.00000-1.00000024.0000000.00000030.000000-0.3333333-9-40.000000-0.333333356.0000000.00000060.000000-0.333333370.0000000.00000080.000000-0.3333333五、计算如下运输问题:B1B2B3B4B5B6B7B8产量A16267425960A24953858255A35219743351A47673927143A52395726541A65522814352需求量3537223241324338解:x1,x2,x3,x4,x5,x6是6个产地,y1,y2,y3,y4,y5,y6,y7,y8是8个销地输入模型:sets:need/x1,x2,x3,x4,x5,x6/:re;coul/y1,y2,y3,y4,y5,y6,y7,y8/:requ;link(need,coul):cost,num;endsetsdata:cost=626742594953858252197433销地单位运费产地-10-767392712395726555228143;re=605551434152;requ=3537223241324338;enddatamin=@sum(link:cost*num);@for(need(i):@sum(coul(j):num(i,j))=re(i));@for(coul(j):@sum(need(i):num(i,j))=requ(j));end结果如下:Globaloptimalsolutionfound.Objectivevalue:664.0000Totalsolveriterations:25VariableValueReducedCostRE(X1)60.000000.000000RE(X2)55.000000.000000RE(X3)51.000000.000000RE(X4)43.000000.000000RE(X5)41.000000.000000RE(X6)52.000000.000000-11-REQU(Y1)35.000000.000000REQU(Y2)37.000000.000000REQU(Y3)22.000000.000000REQU(Y4)32.000000.000000REQU(Y5)41.000000.000000REQU(Y6)32.000000.000000REQU(Y7)43.000000.000000REQU(Y8)38.000000.000000COST(X1,Y1)6.0000000.000000COST(X1,Y2)2.0000000.000000COST(X1,Y3)6.0000000.000000COST(X1,Y4)7.0000000.000000COST(X1,Y5)4.0000000.000000COST(X1,Y6)2.0000000.000000COST(X1,Y7)5.0000000.000000COST(X1,Y8)9.0000000.000000COST(X2,Y1)4.0000000.000000COST(X2,Y2)9.0000000.000000COST(X2,Y3)5.0000000.000000COST(X2,Y4)3.0000000.000000COST(X2,Y5)8.0000000.000000COST(X