资源描述:
《北京工业大学-工程数学-薛毅-作业3.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、最优化与存储模型实验1.曲线拟合有关部门希望研究车速与刹车距离之间的关系y=β0+β1x其中x为车速,y为刹车距离,现测得50组数据(xi,yi)(i=1,2,…,50)(见表3.1),用三种方法((1)平方和最小;(2)绝对偏差和最小;(3)最大偏差最小)估计系数β0和β1,并分析三种方法的计算效果(注:用LINGO软件求解,用其他软件画出散点图和回归直线),说明哪一种方法得到有结果更合理。解答:(1)平方和最小,即为最小二乘法,相应的无约束问题为:maxβ0,β1Z=i=1n(β0+β1x-y)2LINGO语句:se
2、ts:quantity/1..50/:x,y;endsetsdata:x=4,4,7,7,8,9,10,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,16,16,17,17,17,18,18,18,18,19,19,19,20,20,20,20,20,22,23,24,24,24,24,25;y=2,10,4,22,16,10,18,26,34,17,28,14,20,24,28,26,34,34,46,26,36,60,80,20,26,54,32,4
3、0,32,40,50,42,56,76,84,36,46,68,32,48,52,56,64,66,54,70,92,93,120,85;enddatamin=@sum(quantity:(a*x+b-y)^2);@free(a);@free(b);运行结果:Localoptimalsolutionfound.Objectivevalue:11353.52Infeasibilities:0.000000Extendedsolversteps:5Totalsolveriterations:18VariableValueRe
4、ducedCostA3.9324090.000000B-17.579090.000000结果分析:Y=3.9324x-17.5791(1)绝对偏差和最小,即为最小一乘法,相应的无约束问题为:maxβ0,β1Z=i=1nβ0+β1x-yLINGO语句:sets:quantity/1..50/:x,y;endsetsdata:x=4,4,7,7,8,9,10,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,16,16,17,17,17,18,18,18,18,
5、19,19,19,20,20,20,20,20,22,23,24,24,24,24,25;y=2,10,4,22,16,10,18,26,34,17,28,14,20,24,28,26,34,34,46,26,36,60,80,20,26,54,32,40,32,40,50,42,56,76,84,36,46,68,32,48,52,56,64,66,54,70,92,93,120,85;enddatamin=@sum(quantity:@abs(a*x+b-y));@free(a);@free(b);运行结果:Glob
6、aloptimalsolutionfound.Objectivevalue:563.8000Objectivebound:563.8000Infeasibilities:0.000000Extendedsolversteps:0Totalsolveriterations:82VariableValueA3.400000B-11.60000结果分析:Y=3.4x-11.6(1)最大偏差最小,即为最小无穷模法,相应的无约束问题为:maxβ0,β1Z=max1≤i≤nβ0+β1x-yLINGO语句:sets:quantity/
7、1..50/:x,y;endsetsdata:x=4,4,7,7,8,9,10,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,16,16,17,17,17,18,18,18,18,19,19,19,20,20,20,20,20,22,23,24,24,24,24,25;y=2,10,4,22,16,10,18,26,34,17,28,14,20,24,28,26,34,34,46,26,36,60,80,20,26,54,32,40,32,40,50,4
8、2,56,76,84,36,46,68,32,48,52,56,64,66,54,70,92,93,120,85;enddatamin=@max(quantity:@abs(a*x+b-y));@free(a);@free(b);运行结果:Globaloptimalsolutionfound.Objectiveval