数学建模课后作业第四章.doc_第1页
数学建模课后作业第四章.doc_第2页
数学建模课后作业第四章.doc_第3页
数学建模课后作业第四章.doc_第4页
数学建模课后作业第四章.doc_第5页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第四章, 最优化与存储模型实验4.2,基本实验1.非线性最小二乘问题解:由题可以得出:(1)最小二乘法,分别用x、y代替、平方和的形式时的lingo程序:sets:quantity/1.15/: x,y;endsetsmin=sum(quantity: (b*2.71828(c*x)+a-y)2);free(a); free(b);free(c);data:x=2 5 7 10 14 19 26 31 34 38 45 52 53 60 65;y=54 50 45 37 35 25 20 16 18 13 8 11 8 4 6;enddata运行程序后可以得出: Local optimal solution found. Objective value: 44.78049 Infeasibilities: 0.000000 Extended solver steps: 5 Total solver iterations: 64 Model Class: NLP Total variables: 4 Nonlinear variables: 3 Integer variables: 0 Total constraints: 2 Nonlinear constraints: 1 Total nonzeros: 4 Nonlinear nonzeros: 3 Variable Value Reduced Cost B 57.33209 0.000000 C -0.4460386E-01 0.3922619E-07 A 2.430177 0.000000 X( 1) 2.000000 0.000000 X( 2) 5.000000 0.000000 X( 3) 7.000000 0.000000 X( 4) 10.00000 0.000000 X( 5) 14.00000 0.000000 X( 6) 19.00000 0.000000 X( 7) 26.00000 0.000000 X( 8) 31.00000 0.000000 X( 9) 34.00000 0.000000 X( 10) 38.00000 0.000000 X( 11) 45.00000 0.000000 X( 12) 52.00000 0.000000 X( 13) 53.00000 0.000000 X( 14) 60.00000 0.000000 X( 15) 65.00000 0.000000 Y( 1) 54.00000 0.000000 Y( 2) 50.00000 0.000000 Y( 3) 45.00000 0.000000 Y( 4) 37.00000 0.000000 Y( 5) 35.00000 0.000000 Y( 6) 25.00000 0.000000 Y( 7) 20.00000 0.000000 Y( 8) 16.00000 0.000000 Y( 9) 18.00000 0.000000 Y( 10) 13.00000 0.000000 Y( 11) 8.000000 0.000000 Y( 12) 11.00000 0.000000 Y( 13) 8.000000 0.000000 Y( 14) 4.000000 0.000000 Y( 15) 6.000000 0.000000 Row Slack or Surplus Dual Price 1 44.78049 -1.000000即a=2.4302,b=57.3321,c=-0.0446039y=2.4302+57.3321e(-0.0446039x)=2.4302+57.3321e-0.0446039(2)最小一乘法,分别用x、y代替、的形式时的lingo程序:sets: quantity/1.15/: x,y;endsetsdata: x = 2,5,7,10,14,19,26,31,34,38,45,52,53,60,65; y = 54,50,45,37,35,25,20,16,18,13,8,11,8,4,6;enddatamin=sum(quantity: abs(a+b*exp(c*x)-y);free(a); free(b); free(c);运行程序后可得: Linearization components added: Constraints: 60 Variables: 60 Integers: 15 Local optimal solution found. Objective value: 20.80640 Objective bound: 20.80640 Infeasibilities: 0.1219750E-06 Extended solver steps: 0 Total solver iterations: 69 Model Class: MINLP Total variables: 64 Nonlinear variables: 2 Integer variables: 15 Total constraints: 62 Nonlinear constraints: 15 Total nonzeros: 196 Nonlinear nonzeros: 30 Variable Value Reduced Cost A 3.398266 0.000000 B 57.11461 0.000000 C -0.4752126E-01 0.000000 X( 1) 2.000000 0.000000 X( 2) 5.000000 0.000000 X( 3) 7.000000 0.000000 X( 4) 10.00000 0.000000 X( 5) 14.00000 0.000000 X( 6) 19.00000 0.000000 X( 7) 26.00000 0.000000 X( 8) 31.00000 0.000000 X( 9) 34.00000 0.000000 X( 10) 38.00000 0.000000 X( 11) 45.00000 0.000000 X( 12) 52.00000 0.000000 X( 13) 53.00000 0.000000 X( 14) 60.00000 0.000000 X( 15) 65.00000 0.000000 Y( 1) 54.00000 0.000000 Y( 2) 50.00000 0.000000 Y( 3) 45.00000 0.000000 Y( 4) 37.00000 0.000000 Y( 5) 35.00000 0.000000 Y( 6) 25.00000 0.000000 Y( 7) 20.00000 0.000000 Y( 8) 16.00000 0.000000 Y( 9) 18.00000 0.000000 Y( 10) 13.00000 0.000000 Y( 11) 8.000000 0.000000 Y( 12) 11.00000 0.000000 Y( 13) 8.000000 0.000000 Y( 14) 4.000000 0.000000 Y( 15) 6.000000 0.000000 Row Slack or Surplus Dual Price 1 20.80640 -1.000000a=3.3983 , b=57.1146 , c=-0.04752;=3.3983+57.1146e-0.04752 ;(3)最大偏差最小法,分别用x、y代替、的形式时的lingo程序:sets: quantity/1.15/: x,y;endsetsdata: x = 2,5,7,10,14,19,26,31,34,38,45,52,53,60,65; y = 54,50,45,37,35,25,20,16,18,13,8,11,8,4,6;enddatamin=max(quantity: (a+b*exp(c*x)-y)2)0.5);free(a); free(b); free(c);运行程序可以得出: Linearization components added: Constraints: 31 Variables: 16 Integers: 15 Local optimal solution found. Objective value: 3.287687 Objective bound: 3.287687 Infeasibilities: 0.3513839E-05 Extended solver steps: 2 Total solver iterations: 666 Model Class: MINLP Total variables: 20 Nonlinear variables: 3 Integer variables: 15 Total constraints: 33 Nonlinear constraints: 30 Total nonzeros: 152 Nonlinear nonzeros: 90 Variable Value A 4.360430 B 53.99638 C -0.4858083E-01 X( 1) 2.000000 X( 2) 5.000000 X( 3) 7.000000 X( 4) 10.00000 X( 5) 14.00000 X( 6) 19.00000 X( 7) 26.00000 X( 8) 31.00000 X( 9) 34.00000 X( 10) 38.00000 X( 11) 45.00000 X( 12) 52.00000 X( 13) 53.00000 X( 14) 60.00000 X( 15) 65.00000 Y( 1) 54.00000 Y( 2) 50.00000 Y( 3) 45.00000 Y( 4) 37.00000 Y( 5) 35.00000 Y( 6) 25.00000 Y( 7) 20.00000 Y( 8) 16.00000 Y( 9) 18.00000 Y( 10) 13.00000 Y( 11) 8.000000 Y( 12) 11.00000 Y( 13) 8.000000 Y( 14) 4.000000 Y( 15) 6.000000 Row Slack or Surplus 1 3.287687由此可知最大偏差最小时相应曲线为:=4.3604+53.9964*e(-0.04858*x) 由此对比可知三种方法时的时候相应模拟曲线为:=2.4302+57.3321e-0.0446039 (下图绿线);=4.3604+53.9964*e(-0.04858*x) (下图蓝线);=3.3983+57.1146e-0.04752 ;(下图红线);相应的曲线图与散点图Matlab程序为:x=2 5 7 10 14 19 26 31 34 38 45 52 53 60 65y=54 50 45 37 35 25 20 16 18 13 11 8 8 4 6plot(x,y,.);hold on;x=2:3:65;y=2.4302+57.3321.*2.71828.(-0.0446039.*x);plot(x,y,-g);hold on;x=2:3:65;y=3.3983+57.1146.*2.71828.(-0.04752.*x);plot(x,y, -r);hold on;x=2:3:65;y=4.3604+53.9964.*2.71828.(-0.04858.*x);plot(x,y, -b);hold on;相应的曲线图为:2.非线性优化问题:解:(1)令x11、x12、x13为汽油加工所需要的A、B类原油与广告费的值,令x21、x22、x23为民用燃油所需要的A、B类原油与广告费的值。相应的目标函数为总利润Z=250*x13/10*5+200*x23/10*10-x13-x23 =124*x13+199*x23约束条件为:(10x11+5x12)/(x11+x12)8;(10x21+5x22)/(x21+x22)6;x11+x215000;x12+x2210000;5*x13/10x11+x12;10*x23/10x21+x22;则可以得出对应的lingo程序:max=124*x13+199*x23;(10*x11+5*x12)/(x11+x12)=8;(10*x21+5*x22)/(x21+x22)=6;(10*x21+5*x22)/(x21+x22)=8;x11+x21=5000;x12+x22=0.5*x13;x21+x22=x23;GIN(x11);GIN(x12);GIN(x13);GIN(x21);GIN(x22);GIN(x23);运行程序后可得: Local optimal solution found. Objective value: 3230000. Objective bound: 3230000. Infeasibilities: 0.000000 Extended solver steps: 1 Total solver iterations: 44 Model Class: PINLP Total variables: 6 Nonlinear variables: 4 Integer variables: 6 Total constraints: 8 Nonlinear constraints: 3 Total nonzeros: 18 Nonlinear nonzeros: 6 Variable Value X13 10000.00 X23 10000.00 X11 3000.000 X12 2000.000 X21 2000.000 X22 8000.000 Row Slack or Surplus 1 3230000. 2 0.000000 3 0.000000 4 2.000000 5 0.000000 6 0.000000 7 0.000000 8 0.000000由以上可得最优的生产方案即:原油类别原油A/桶原油B/桶广告费/元总利润/元汽油/桶30002000100003230000民用燃油/桶2000800010000(2)由题目中条件可令加入汽油中的SQ为x14桶,可令加入民用燃油中的SQ为x24桶,则可得新的目标函数为:Z=250*x13/10*5+200*x23/10*10-x13-x23-200x14-200x24;约束条件为:x11+x215000;x12+x2210000;(10*x11+5*x12)/(x11+x12+x14)+(x14/(x11+x12+x14)0.5=8;(10x21+5x22)/(x21+x22+x24)+0.6*(x24/(x21+x22+x24)0.6=6;x13/10*5x11+x12+x14;x23/10*10x21+x22+x24;x14(x11+x12)*5%;x24(x21+x22)*5%;则可以得到新的lingo程序:max=124*x13+199*x23-200*x14-200*x24;(1+(x14/(x11+x12+x14)0.5)*(10*x11+5*x12)/(x11+x12)=8;(1+0.6*(x24/(x21+x22+x24)0.6)*(10*x21+5*x22)/(x21+x22)=6;x11+x21=5000;x12+x22=0.5*x13;x21+x22+x24=x23;0.05*x11+0.05*x12=x14;0.05*x21+0.05*x22=x24;GIN(x11);GIN(x12);GIN(x13);GIN(x14);GIN(x21);GIN(x22);GIN(x23);GIN(x24);运行程序后可得: Local optimal solution found. Objective value: 3755856. Objective bound: 3755856. Infeasibilities: 0.000000 Extended solver steps: 2 Total solver iterations: 902 Model Class: PINLP Total variables: 8 Nonlinear variables: 6 Integer variables: 8 Total constraints: 9 Nonlinear constraints: 2 Total nonzeros: 28 Nonlinear nonzeros: 6 Variable Value X13 31494.00 X23 0.000000 X14 747.0000 X24 0.000000 X11 5000.000 X12 10000.00 X21 0.000000 X22 0.000000 Row Slack or Surplus 1 3755856. 2 0.1186784 3 0.1000000E+31 4 0.000000 5 0.000000 6 0.000000 7 0.000000 8 3.000000则可以得到新的生产方案:原油类别原油A/桶原油B/桶广告费/元SQ/桶总利润/元汽油/桶500010000314947473755856民用燃油/桶0000(3)当x14

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论