中职 优化计算方法及其MATLAB程序实现第2章电子课件 高教版 .pdf

上传人:春哥&#****71; 文档编号:90567987 上传时间:2023-05-15 格式:PDF 页数:38 大小:593.69KB
返回 下载 相关 举报
中职 优化计算方法及其MATLAB程序实现第2章电子课件 高教版 .pdf_第1页
第1页 / 共38页
中职 优化计算方法及其MATLAB程序实现第2章电子课件 高教版 .pdf_第2页
第2页 / 共38页
点击查看更多>>
资源描述

《中职 优化计算方法及其MATLAB程序实现第2章电子课件 高教版 .pdf》由会员分享,可在线阅读,更多相关《中职 优化计算方法及其MATLAB程序实现第2章电子课件 高教版 .pdf(38页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、1/38JJIIJIBackClosezO9MATLABSy1?|2/38JJIIJIBackClosel?m,0?zK?.e?z?.minxRnf(x).(2.1)|)?zK?,k!?:.?|95.3119?zKS“?e,ke?S“:L,|(fk,?f(xk+kdk)f(xk).(2.2)S(nC?)8If(x)35?/?CzK,?/|0/|0.-()=f(xk+dk),(2.3)3/38JJIIJIBackClose?,|(2.2)?dufk?(k)0f(xk+dk)(k)=min0().ef(x)Y?,od(|?fkkXe5:f(xk+kdk)Tdk=0(=gTk+1dk=0).(2.4

2、)5(2.4)3?5X-?.4/38JJIIJIBackClose(|,?k8If?e,=fk=f(xk)f(xk+kdk)0?.2.1(|9MATLABy(|?g:k(K)?|m,?,?E?m,?1|).e|m?.2.1?38?,0,+),()=min0().(2.5)e3ma,b 0,+),(a,b),Ka,b4?zK(2.5)?|m.?,e?()3a,4,35/38JJIIJIBackClose,b4O,Ka,b()?m,()a,b?.e0?(|m?ykCq5?,?gl:u,U,(y/p-$-p0?n:,l?Cq?m.2.1(Cqm?)0,?0 0,h0 0.O0:=(0).-k:=0.

3、1,-k+1:=k+hk,Ok+1:=(k+1).ek+1 k,=2;K,=3.2,.-hk+1:=2hk,:=k,k:=k+1,k:=k+1,k:=k+1,=1.3,|.ek=0,-h1:=h0,:=1,6/38JJIIJIBackClose1:=0,1:=0,k:=1,=1;K,S“,-a=min,k+1,b=max,k+1.a,b.(|a:a?|,X?!9?;,a?|,X7!9-”?.?=0?7?.2.1.1770.618,?g:L&:?,4?:?|m?.T=IO,2,B.e?7?O.7/38JJIIJIBackClose?(s)=f(xk+sdk),:(s)|ma0,b0?.31igS

4、“,|mai,bi.?&:pi,qiai,bipi(qi),K-ai+1:=pi,bi+1:=bi.&:piqive:1?ai,qipi,bi?,=bi pi=qi ai;2?m?,=bi+1 ai+1=t(bi ai).l?pi=ai+(1 t)(bi ai),qi=ai+t(bi ai).(2.6)8/38JJIIJIBackClosey3/(1).d,#?|mai+1,bi+1=ai,qi.?|m,I?#?&:pi+1,qi+1.d(2.6),?qi+1=ai+1+t(bi+1 ai+1)=ai+t(qi ai)=ai+t2(bi ai).e-t2=1 t,t 0,(2.7)Kqi+1=

5、ai+(1 t)(bi ai)=pi.?,#?&:qi+1I-#O.aq/,u/(2),k?(.9/38JJIIJIBackClose)(2.7)?m t=5 12 0.618.d,?7?OXe.2.2(7)0,(|ma0,b0NN?0 6?1.-t=(5 1)/2,O&:p0=a0+(1 t)(b0 a0),q0=a0+t(b0 a0)9A?(p0),(q0).-i:=0.1,e(pi)6(qi),=2;K,=3.2,O&:.e|qi ai|6,pi;K,-ai+1:=ai,bi+1:=qi,(qi+1):=(pi),10/38JJIIJIBackCloseqi+1:=pi,pi+1:=ai

6、+1+(1 t)(bi+1 ai+1).O(pi+1),i:=i+1,=1.3,Om&:.e|bi pi|6,qi;K,-ai+1:=pi,bi+1:=bi,(pi+1):=(qi),pi+1:=qi,qi+1:=ai+1+t(bi+1 ai+1).O(qi+1),i:=i+1,=1.?,duzgS“|m?t 0.618,?75?,=?O?p,?TzgS“IOg?:v.e7C3mCq4?:?MATLABS.11/38JJIIJIBackCloseS2.1(7S)7C3ma,b?Cq4?:.function i,s,phis,ds,dphi,G=golds(phi,a,b,epsilon,del

7、ta)%U:7(|%:phi8I,a,b|m?:,%epsilon,deltaOgC?NN?%:iS“g,s,phisOCq4?:4?,%ds,dphiOsphis?,Gix4?,%1i1Oa,p,q,b?1igS“ai,pi,qi,bit=(sqrt(5)-1)/2;h=b-a;phia=feval(phi,a);phib=feval(phi,b);p=a+(1-t)*h;q=a+t*h;phip=feval(phi,p);phiq=feval(phi,q);12/38JJIIJIBackClosei=1;G(i,:)=a,p,q,b;while(abs(phib-phia)delta)|(

8、hepsilon)if(phip=phiq)b=q;phib=phiq;q=p;phiq=phip;h=b-a;p=a+(1-t)*h;phip=feval(phi,p);elsea=p;phia=phip;p=q;phip=phiq;h=b-a;q=a+t*h;phiq=feval(phi,q);endi=i+1;G(i,:)=a,p,q,b;endif(phip phi=(x)3*x2-2*tan(x);i,s,phis,ds,dphi,G=golds(phi,0,1,1e-4,1e-5)?=?L2.1?(J.L2.17C4?:?(JS“g(i)4?:(s)4?(s)|bi ai|?|(b

9、i)(ai)|?210.38950.36586.6107 1052.7880 10914/38JJIIJIBackClose2.1.2?g?,?g:3|m/?g?Cq8I,?4?:?%C|Kmins0(s)=f(xk+sdk)?4?:.e0?.?n:s0,s1=s0+h,s2=s0+2h(h 0)?0,1,2,v1 0,1 0.(2.10)16/38JJIIJIBackCloseqq(s)?q00(s)=0h221h2+2h2=0 21+2h2 0,?q(s)?g,l?sminq(s)?4?:.5?s=s0+hs0/%C4?:s,?s,hOOs0h-EOL,#?s#?h.-ES“L,?I?.?

10、,8I?3(2.8)/5(?g?4?:,?SyI?.2.3(?)0,d2.1(n:s0 s1 s2,A?0,1,2v1 0,1 2.17/38JJIIJIBackClose?NN?0 6?1.1,e|s2 s0|s,Ks2:=s1,s1:=s,2:=1,1:=,=1;K,s0:=s1,s1:=s,0:=1,1:=,=1.4,es11e4),h=abs(s0)*(1e-4);endwhile(idelta&cond=5)f1=(feval(phi,s0+ds)-feval(phi,s0-ds)/(2*ds);if(f10),h=-abs(h);ends1=s0+h;s2=s0+2*h;bars=

11、s0;19/38JJIIJIBackClosephi0=feval(phi,s0);phi1=feval(phi,s1);phi2=feval(phi,s2);barphi=phi0;cond=0;j=0;%(h?phi1phi0phi1phi2while(jepsilon&cond=0)if(phi0=phi1),s2=s1;phi2=phi1;h=0.5*h;s1=s0+h;phi1=feval(phi,s1);else if(phi2big|abs(s0)big),cond=5;endendif(cond=5)bars=s1;barphi=feval(phi,s1);else%?g?ph

12、isd=2*(2*phi1-phi0-phi2);if(d0),barh=h*(4*phi1-3*phi0-phi2)/d;elsebarh=h/3;cond=4;21/38JJIIJIBackCloseendbars=s0+barh;barphi=feval(phi,bars);h=abs(h);h0=abs(barh);h1=abs(barh-h);h2=abs(barh-2*h);%(egS“?hif(h0h),h=h0;endif(h1h),h=h1;endif(h2h),h=h2;endif(h=0),h=barh;endif(hbig|abs(bars)big),cond=5;en

13、derr=abs(barphi-phi1);s0=bars;i=i+1;S(i)=s0;22/38JJIIJIBackCloseendif(cond=2&h phi=(x)3*x2-2*tan(x);i,s,phis,ds,dphi,S=qmin(phi,0,1,1e-4,1e-5)?=?XL2.2?(J.L2.2?C4?:?(JS“g(i)4?:(s)4?(s)|s s1|?|(s)(s1)|?50.38950.36585.9671 1057.2670 10923/38JJIIJIBackClose2.2(|9MATLABy|)NzKe?|,?(|IO?F,l?O?.AO?S“:?l:,(|

14、k?n?.uNz,6u(|L.d,QU?y8Ik?e,qU/?S“S?(|C?5?61.?X-0?(|?WolfeOKArmijoOK.24/38JJIIJIBackClose2.2.1 WolfeOKWolfeOK (0,0.5),(,1),k?e?:f(xk+kdk)6 f(xk)+kgTkdk,(2.11)f(xk+kdk)Tdk gTkdk,(2.12):gk=g(xk)=f(xk).(2.12)k,r?|f(xk+kdk)Tdk|6 gTkdk(2.13)5“O.?,?0?,?y(2.13)CCq(|.(2.11)(2.13)rWolfeOK.rWolfeOKL,dTOK?#?S“:

15、xk+1=xk+kdk3xk?,?S8Ik?e.25/38JJIIJIBackClosedugTkdk 0,yWolfeOK?k5,=fk?35,ke?n.n2.1?f(x)ke.gTkdk 0,-(0,0.5),(,1),K3ma,b(0 a b),?z a,bv(2.11)(2.13).2.2.2 ArmijoOKArmijoOK (0,1),(0,0.5).-fk=mk,mkve?K?:f(xk+mdk)6 f(xk)+mgTkdk.(2.14)y,ef(x)Y?vgTkdk 0,KArmijoOKk?,=3?,?u?m,(2.14)26/38JJIIJIBackClose.?Sy?B,

16、Armijo|?e?.2.4(ArmijoOK)(0,1),(0,0.5).m=0,1,e?f(xk+mdk)6 f(xk)+mgTkdk,Kmk:=m,xk+1:=xk+mkdk,1k|?.eArmijo|?MATLABS.S2.3(Armijo|S)Armijo|OKN5z7L1?,r?-E|?S?k?.function mk=armijo(xk,dk)27/38JJIIJIBackClosebeta=0.5;sigma=0.2;m=0;maxm=20;while(m=maxm)if(fun(xk+betam*dk)=fun(xk)+sigma*betam*gfun(xk)*dk)mk=m

17、;break;endm=m+1;endalpha=betamknewxk=xk+alpha*dkfk=fun(xk)newfk=fun(newxk)28/38JJIIJIBackClose5 S2.3?fungfunO8I?F?fS.1L,7LkO?fS.S2.3)e?zfK.2.3?zKminxR2f(x)=100(x21 x2)2+(x1 1)2,?cS“:xk=(1,1)T,edk=(1,2)T.|S2.3fk.)k,?8I9F?mfun.mgfun.m:%8Ifunction f=fun(x)f=100*(x(1)2-x(2)2+(x(1)-1)2;%F29/38JJIIJIBackC

18、losefunction gf=gfun(x)gf=400*x(1)*(x(1)2-x(2)+2*(x(1)-1);-200*(x(1)2-x(2);,?,3MATLAB-IXe-:xk=-1,1;dk=1,-2;mk=armijo(xk,dk)?mk=2;k=0.25;xk+1=(0.75,0.5)T;f(xk)=4;f(xk+1)=3.4531.2.3|?5e|?5(J./|0|f?zKea?,?eXe.2.5(|e)30/38JJIIJIBackClose0,z.?k9S“:x0 Rn.?NN?0 6?1.-k:=0.1,u?OOK.Ogk=f(xk).ekgkk 6,x xk.2,(e

19、dk,vgTkdk0f(xk+dk);(2.15)(2)2.2!0?WolfeOKArmijoOK?(|k.4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k(kdk)=gTksk61?f(xk)f(xk+1)?0.(2.22)?0 6 kgkkkskksi

23、n 6 kgkkkskkcosk=gTksk 0.36/38JJIIJIBackClose5?kgkk 0,?d7kkskk 0.qduf(x)3Y8L(x0)Y?,kf(xk+1)Tsk=gTksk+o(kskk),=limkf(xk+1)TskgTksk=1,(2.12)9 mk1gTkdk.5?mk1dk=sk/,?=f?xk+1sk?f(xk)gTk?sk?.(2.23)e-pk=skkskk,Ksk=kskkpk.dkskk 0,0k=kskk 0,(2.23)U?f(xk+0kpk)f(xk)0k gTkpk.kpkk=1,?kpkkk.,l?3?f?,EPkpkk p(kpk=1).?4,?f(x)Tp f(x)Tp.38/38JJIIJIBackClosedd,?f(x)Tp 0.(2.24),5?pk=skkskk=dkkdkk,?kgTkpk=gTk?dkkdkk?=kgkkcosk kgkksin.?4,?f(x)Tp kf(x)ksin 0,=f(x)Tp 0,(2.24)g.?7kf(x)=0.y.?

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 大学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁