《中国石油大学建模作业.docx》由会员分享,可在线阅读,更多相关《中国石油大学建模作业.docx(8页珍藏版)》请在第一文库网上搜索。
1、数学规划上机实践作业一1首先练习一下书中线性规划案例。2某企业和用户签定了设备交货合同,已知该企业各季度的生产能力、每台设备的生产成本和每季度末的交货量见下表,若生产出的设备当季度不交货,每台设备每季度需要支付保管费0.1万元,试问在遵守合同的条件下,企业应如何安排生产计划,才能使年消耗费用最低?季度工厂生产能力(台)交货量(台)每台设备生产成本(万元/台)1251512.02352011.03302511.54202012.5变定义:设第i季度生产七台,i=1,2,3,4;模型假设:,每个季度都交货交满第四季度交货后无设备剩余;x115,z=12*x1+(x1-15)*0.1+x2*11+(
2、x2+x1-15-20)*0.1+xj*11.5+(x3x2+x1-15-20-25)*0.1+x4*12.5约束条件:X4+冗3+*2+再-152025=20,“3+2+X15202500x235,0x330,0x420e1ingO程序:mode1:min=12*x1+(x1-15)*0.1+11*x2+(x2+x1-15-20)*0.1+x3*11.5+(x3+x2+x1-15-20-25)*0.1+x4*12.5;x2+x1=35;x3+x2+x1=60;x4+x3+x2+x1=80;x1=15;x2=35;x3=30;x4=20;0gin(x1);0gin(x2);gin(x3);gi
3、n(x4);End程序运行结果:G1oba1optima1so1utionfound.Objectiveva1ue:913.5000Objectivebound:913.5000Infeasibi1ities:0.000000Extendedso1versteps:0Tota1so1veriterations:0Variab1eVa1ueReducedCostX115.0000012.30000X235.0000011.20000X330.0000011.60000X40.00000012.50000RowS1ackorSurp1usDua1Price1913.5000-1.00000020.
4、0000000.000000315.000000.000000420.000000.00000050.0000000.00000060.0000000.00000070.0000000.000000820.000000.000000建模结果:第一季度生产15台,第二季度生产35台,第三季度生产30台,第四季度生产0台,最小值913.5万元。甲乙丙丁戊蝶泳1,06,857,210”1,079,4仰泳1,15,619061,079,819149921,11,9蛙泳19271,06,941,249,61,09,61,23,98自由泳58653”59,94579921902994五名选手的百米成绩如上
5、所示;如何选拔队员组成4x100米混合泳接力队?讨论:丁的蛙泳成绩退步到115”2;戊的自由泳成绩进步到57”5,组成接力队的方案是否应该调整?变定义:设Xij=1表示第i个人参加第/个项目,Xij=O表示第i个人没有参加第j个项目,为第i个人的第/个项目的成绩(i=123,4,5,j=1,2,3,4)目标函数:z=/=I;=1约束条件:每个人最多参加一个项目,所以f%1,(i=1,2,3,4,5),每个项目必须有且最J=I多有一个人选择,所以次学.=1,()=1,2,3,4),同时有局0,1。Z=I1ingO程序Mode1:sets:person/1.5/;position/1.4/;1in
6、k(person,position):x,a;endsetsdata:a=6.8,75.,87,58.,57.2,66f66.4,53,78,67.8,84.6,59.4,70,74.2,69.6,57.2z67.4,71,83.8,62.4;enddatamin=sum(1ink:x*a);for(person(i):sum(position(j):x(i,j)=1;);for(position(j):sum(person(i):x(i,j)=1;);for(1ink:bin(x);end程序运行结果G1oba1optima1so1utionfound.Objectiveva1ue:253.
7、2000Objectivebound:253.2000Infeasibi1ities:0.000000Extendedso1versteps:0Tota1so1veriterations:0Variab1eVa1ueReducedCost(1,D0.00000066.80000(1,2)0.00000075.60000X(1,3)0.00000087.00000(1,4)1.00000058.60000(2,1)1.00000057,20000(2,2)0.00000066.00000X(2,3)0.00000066.40000(2,4)0.00000053.00000(3,1)0.00000
8、078.00000(3,2)1.00000067.80000X(3,3)0.00000084.60000(3,4)0.00000059.40000(4z1)0.00000070.00000(4z2)0.00000074.20000X(4,3)1.00000069.60000(4,4)0.00000057.20000(5z1)0.00000067.40000(5,2)0.00000071.00000X(5,3)0.00000083.80000(5z4)0.00000062.40000A(1,1)66.800000.000000A(1,2)75.600000.000000A(1,3)87.0000
9、00.000000A(1z4)58.600000.000000A(2,1)57.200000.000000A(2,2)66.000000.000000A(2,3)66.400000.000000A(2,4)53.000000.000000A(3,D78.000000.000000A(3,2)67.800000.000000A(3,3)84.600000.000000A(3,4)59.400000.000000A(4,D70.000000.000000A(4,2)74.200000.000000A(4,3)69.600000.000000A(4,4)57.200000.000000A(5,D67
10、.400000.000000A(5,2)71.000000.000000A(5,3)83.800000.000000A(5,4)62.400000.000000RowS1ackorSurp1usDua1Price1253.2000-1.00000020.0000000.00000030.0000000.00000040.0000000.00000050.0000000.00000061.0000000.00000070.0000000.00000080.0000000.00000090.0000000.000000100.0000000.000000模型结论甲乙丙丁4人组队分别参加自由泳、蝶泳
11、、仰泳、蛙泳的比赛,成绩为253.2s=413”2。模型分析当队员丁的蛙泳成绩有较大退步,只有1152;而戊的自由泳成绩进步到575,对Iingo程序进行修改,重新建模。程序以及运行结果为Mode1:sets:person/1.5/;position/1.4/;1ink(person,position):x,a;endsetsdata:a=66.8,75.6,87,58.6,57.2,66,66.4z53,78,67.8,84.6,59.4,70,74.2,75.2,57.2,67.4,71,83.8,57.5;enddatamin=sum(1ink:x*a);for(person(i):su
12、m(position(j):x(i,j)=1;);for(position(j):sum(person(i):x(i,j)=1;);for(1ink:bin(x);endG1oba1optima1so1utionfound.Objectiveva1ue:257.7000Objectivebound:257.7000Infeasibi1ities:0.000000Extendedso1versteps:0Tota1so1veriterations:0Variab1eVa1ueReducedCostX(1,D0.00000066.80000X(1,2)0.00000075.60000(1,3)0.
13、00000087.00000X(1,4)0.00000058.60000(2,1)1.00000057.20000X(2,2)0.00000066.00000X(2,3)0.00000066.40000X(2,4)0.00000053.00000X(3,1)0.00000078.00000(3,2)1.00000067.80000X(3,3)0.00000084.60000X(3,4)0.00000059.40000X(4,1)0.00000070.00000X(4,2)0.00000074.20000X(4,3)1.00000075.20000X(4z4)0.00000057.20000X(5,1)0.00000067.40000(5z2)0.00000071.00000(5,3)0.00000083.80000X(5,4)1.000000