《数学实验》实验报告(共9页).doc
精选优质文档-倾情为你奉上数学实验实验报告( 2012 年 4 月 8 日)班级:数学系0902班学号 :姓名:马骁一、实验问题 1(指派问题)考虑指定n个人完成n项任务(每人单独承担一项任务),使所需的总完成时间(成本)尽可能短. 已知某指派问题的有关数据(每人完成各任务所需的时间)如下表所示,试建模并求解该指派问题。2(二次指派问题)某公司指派n个员工到n个城市工作(每个城市单独一人),希望使所花费的总电话费用尽可能少。n个员工两两之间每个月通话的时间表示在下面的矩阵的上三角部分(因为通话的时间矩阵是对称的,没有必要写出下三角部分),n个城市两两之间通话费率表示在下面的矩阵的下三角部分(同样道理,因为通话的费率矩阵是对称的,没有必要写出上三角部分). 试求解该二次指派问题。3、谢金星第四章课后习题第1或3题任选一题。二、问题的分析(涉及的理论知识、数学建模与求解的方法等) 1)根据实际问题,建立数学优化模型 2)根据优化模型,利用LINGO 来求解模型。三、计算过程、结论和结果分析1. 模型:model:sets:m/1.4/;n/1.4/;link(m,n):a,x;endsetsmin=sum(link(i,j):x(i,j)*a(i,j);for(m(i):sum(n(j):a(i,j)=1);for(n(j):sum(m(i):a(i,j)=1);data:x=15 18 21 24 19 23 22 18 26 18 16 19 19 21 23 17;enddataend结果:Global optimal solution found. Objective value: 70.00000 Infeasibilities: 0. Total solver iterations: 7 Variable Value Reduced Cost A( 1, 1) 0. 0. A( 1, 2) 1. 0. A( 1, 3) 0. 5. A( 1, 4) 0. 10.00000 A( 2, 1) 1. 0. A( 2, 2) 0. 1. A( 2, 3) 0. 2. A( 2, 4) 0. 0. A( 3, 1) 0. 11.00000 A( 3, 2) 0. 0. A( 3, 3) 1. 0. A( 3, 4) 0. 5. A( 4, 1) 0. 1. A( 4, 2) 0. 0. A( 4, 3) 0. 4. A( 4, 4) 1. 0. X( 1, 1) 15.00000 0. X( 1, 2) 18.00000 0. X( 1, 3) 21.00000 0. X( 1, 4) 24.00000 0. X( 2, 1) 19.00000 0. X( 2, 2) 23.00000 0. X( 2, 3) 22.00000 0. X( 2, 4) 18.00000 0. X( 3, 1) 26.00000 0. X( 3, 2) 18.00000 0. X( 3, 3) 16.00000 0. X( 3, 4) 19.00000 0. X( 4, 1) 19.00000 0. X( 4, 2) 21.00000 0. X( 4, 3) 23.00000 0. X( 4, 4) 17.00000 0. Row Slack or Surplus Dual Price 1 70.00000 -1. 2 0. -14.00000 3 0. -18.00000 4 0. -14.00000 5 0. -17.00000 6 0. -1. 7 0. -4. 8 0. -2. 9 0. 0.第1个人完成第2项,第2人完成第1项,第3人完成第3项,第4人完成第4项。最短时间为70. 2.模型: model:sets:pe/1,2,3,4,5/;ci/1,2,3,4,5/;lin(pe,ci):x;lin1(pe,pe):d;lin2(ci,ci):c;endsetsmin=sum(lin1(i,j):d(i,j)*sum(lin2(a,b):c(a,b)*x(a,i)*x(b,j);for(pe(m):sum(ci(n):x(m,n)=1);for(ci(n):sum(pe(m):x(m,n)=1);for(lin:bin(x);data:d=0 1 1 2 3 1 0 2 1 2 1 2 0 1 2 2 1 1 0 1 3 2 2 1 0;c=0 5 2 4 1 5 0 3 0 2 2 3 0 0 0 4 0 0 0 5 1 2 0 5 0;enddata end 结果:Local optimal solution found. Objective value: 50.00000 Objective bound: 50.00000 Infeasibilities: 0. Extended solver steps: 18 Total solver iterations: 802 Variable Value Reduced Cost X( 1, 1) 0. 14.00000 X( 1, 2) 0. 0. X( 1, 3) 1. 5. X( 1, 4) 0. 0. X( 1, 5) 0. 6. X( 2, 1) 0. 16.00000 X( 2, 2) 0. 9. X( 2, 3) 0. 0. X( 2, 4) 1. 1. X( 2, 5) 0. 0. X( 3, 1) 0. 14.00000 X( 3, 2) 0. 6. X( 3, 3) 0. 0.E-08 X( 3, 4) 0. 0. X( 3, 5) 1. 0. X( 4, 1) 1. 7. X( 4, 2) 0. 0. X( 4, 3) 0. 5. X( 4, 4) 0. 6. X( 4, 5) 0. 14.00000 X( 5, 1) 0. 0. X( 5, 2) 1. 1. X( 5, 3) 0. 0. X( 5, 4) 0. 9. X( 5, 5) 0. 15.99998 D( 1, 1) 0. 0. D( 1, 2) 1. 0. D( 1, 3) 1. 0. D( 1, 4) 2. 0. D( 1, 5) 3. 0. D( 2, 1) 1. 0. D( 2, 2) 0. 0. D( 2, 3) 2. 0. D( 2, 4) 1. 0. D( 2, 5) 2. 0. D( 3, 1) 1. 0. D( 3, 2) 2. 0. D( 3, 3) 0. 0. D( 3, 4) 1. 0. D( 3, 5) 2. 0. D( 4, 1) 2. 0. D( 4, 2) 1. 0. D( 4, 3) 1. 0. D( 4, 4) 0. 0. D( 4, 5) 1. 0. D( 5, 1) 3. 0. D( 5, 2) 2. 0. D( 5, 3) 2. 0. D( 5, 4) 1. 0. D( 5, 5) 0. 0. C( 1, 1) 0. 0. C( 1, 2) 5. 0. C( 1, 3) 2. 0. C( 1, 4) 4. 0. C( 1, 5) 1. 0. C( 2, 1) 5. 0. C( 2, 2) 0. 0. C( 2, 3) 3. 0. C( 2, 4) 0. 0. C( 2, 5) 2. 0. C( 3, 1) 2. 0. C( 3, 2) 3. 0. C( 3, 3) 0. 0. C( 3, 4) 0. 0. C( 3, 5) 0. 0. C( 4, 1) 4. 0. C( 4, 2) 0. 0. C( 4, 3) 0. 0. C( 4, 4) 0. 0. C( 4, 5) 5. 0. C( 5, 1) 1. 0. C( 5, 2) 2. 0. C( 5, 3) 0. 0. C( 5, 4) 5. 0. C( 5, 5) 0. 0. Row Slack or Surplus Dual Price 1 50.00000 -1. 2 0. -10.00000 3 0. -6. 4 0. 8. 5 0. 0. 6 0. -0.E-05 7 0. -10.00000 8 0. -16.00000 9 0. -14.00000 10 0. -12.00000 11 0. -22.00000第一个人去第三个城市,第二个人去第四个城市,第三个人去第五个城市,第四个人去第一个城市,第五个人去第二个城市 ,最低费用50。 3. 模型:model: min=100*x1+100*x2+40*y1+40*y2+40*y3+40*y4+40*y5;x1+x2+y1>4;x1+x2+y1+y2>3;x1+x2+y1+y2+y3>4;x2+y1+y2+y3+y4>6;x1+y2+y3+y4+y5>5;x1+x2+y3+y4+y5>6;x1+x2+y4+y5>8;x1+x2+y5>8;y1+y2+y3+y4+y5<3;gin(x1);gin(x2);gin(y1);gin(y2);gin(y3);gin(y4);gin(y5);endGlobal optimal solution found. Objective value: 820.0000 Objective bound: 820.0000 Infeasibilities: 0. Extended solver steps: 0 Total solver iterations: 46 Variable Value Reduced Cost X1 3. 100.0000 X2 4. 100.0000 Y1 0. 40.00000 Y2 2. 40.00000 Y3 0. 40.00000 Y4 0. 40.00000 Y5 1. 40.00000 Row Slack or Surplus Dual Price 1 820.0000 -1. 2 3. 0. 3 6. 0. 4 5. 0. 5 0. 0. 6 1. 0. 7 2. 0. 8 0. 0. 9 0. 0. 10 0. 0.说明:该储蓄雇用7名全时服务员,其中3名12:0013:00吃午餐,4名13:0014:00吃午餐;并在10:0014:00雇用2名、13:0017:00雇用1名半时服务员,符合题目要求,且花费最少,为820元。第二问 y1+y2+y3+y4+y5<0;Global optimal solution found. Objective value: 1100.000 Objective bound: 1100.000 Infeasibilities: 0. Extended solver steps: 0 Total solver iterations: 0 Variable Value Reduced Cost X1 5. 100.0000 X2 6. 100.0000 Y1 0. 40.00000 Y2 0. 40.00000 Y3 0. 40.00000 Y4 0. 40.00000 Y5 0. 40.00000 Row Slack or Surplus Dual Price 1 1100.000 -1. 2 7. 0. 3 8. 0. 4 7. 0. 5 0. 0. 6 0. 0. 7 5. 0. 8 3. 0. 9 3. 0. 10 0. 0.说明:不能雇用半时服务员,则需要雇用5名12:0013:00吃午餐、6名13:0014:00吃午餐的全时服务员,总花费为1100元,则每天至少增加280元经费。第三问y1+y2+y3+y4+y5>0;Global optimal solution found. Objective value: 560.0000 Objective bound: 560.0000 Infeasibilities: 0. Extended solver steps: 0 Total solver iterations: 2 Variable Value Reduced Cost X1 0. 100.0000 X2 0. 100.0000 Y1 6. 40.00000 Y2 0. 40.00000 Y3 0. 40.00000 Y4 0. 40.00000 Y5 8. 40.00000 Row Slack or Surplus Dual Price 1 560.0000 -1. 2 2. 0. 3 3. 0. 4 2. 0. 5 0. 0. 6 3. 0. 7 2. 0. 8 0. 0. 9 0. 0. 10 14.00000 0.说明:若雇用半时服务员没有限制,则在9:0013:00雇用6名半时服务员、在13:0017:00雇用8名半时服务员,符合题目要求,且经费最省,为560元,即每天可以减少260元经费。专心-专注-专业