《中职 优化计算方法及其MATLAB程序实现第12章电子课件 高教版 .pdf》由会员分享,可在线阅读,更多相关《中职 优化计算方法及其MATLAB程序实现第12章电子课件 高教版 .pdf(57页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、1/57JJIIJIBackClosezO9MATLABSy1?z?v2/57JJIIJIBackClose?0?)?zK?,;v.?g:?A:,=z,v?8I?,l?zK=zX?zK5).L)X?zK5?zK?)aS?4?z.?0?v!S:f.12.1?v?vdCourant31943cJ5?.eL?f?v?g.12.1)?zKmin f(x)=x21+13x22,s.t.x1+x2=1.3/57JJIIJIBackClose)d?x2=1 x1,“8I?C4?zKmin(x1)=x21+13(x1 1)2,?4?:x1=0.25,l?K?4?:x=(0.25,0.75)T.y3?E?vP(
2、x)vP(x)=0,x1+x2 1=0,0,x1+x2 1 6=0.?qU?ykY?-P(x)=(x1+x21)2.y3?8Iv?|P(x,)=f(x)+P(x)=x21+13x22+(x1+x2 1)2,4/57JJIIJIBackClose:0?,vvf.|?4?:.dP(x,)x1=P(x,)x2=0,?(1+)x1+x2=,3x1+(1+3)x2=3.)|,?x1()=1+4,x2()=31+4.-+,k?x1(),x2()?T?14,34?T=x.?l?zK4?:?4?K?4?:.5/57JJIIJIBackClose12.2)?zKmin f(x)=x2,s.t.x 1 0.)?K
3、?11,+),?4?:x=1.y3?E?vP(x)vP(x)=0,x 1 0,0,x 1 0,x2+(x 1)2,x 1 0.|?4?:x()=1+.-+,kx()1=x.AX1.eg2?zK.min f(x),x Rn,s.t.hi(x)=0,i E=1,2,l,gi(x)0,i I=1,2,m.(12.1)7/57JJIIJIBackClose1v?A.P1D=x Rn|hi(x)=0(i E),gi(x)0(i I).?EvP(x)=lXi=1h2i(x)+mXi=1min0,gi(x)2(12.2)8/57JJIIJIBackCloseO28IP(x,)=f(x)+P(x),(12.3
4、):0vvf.Juy,?x D,=x1:,P(x,)=f(x),d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71:,?kP(x)=0.ey?n?(.(1)kyx?K?1:,=P(x)=0.,dn12.1,P(xk,k)N4Ok.?S?
8、,d,43,?P.d?,5?f(xk)N4O?,f(xk)6 P(xk,k)6 P(x,k)=f(x),=S?f(xk),P4f.uklimkkP(xk)=limk?P(xk,k)f(xk)?=P f.14/57JJIIJIBackClosek+,?7klimkP(xk)=0.dP?Y5P(x)=0,=x1:.(2)2yx?4?:,=f(x)=f(x).df(x)?Y59xk xf(x)=limkf(xk)6 f(x).5?xK?4?:,?w,kf(x)6 f(x),l?f(x)=f(x).d,x?K?4?:.y.?5 n12.1?zS“)fK?xk7L?KminP(x,k)?4?:.:3SO
9、J?,?zK?4?:8E,(J?K,?12.1(?v)?S“”?/?15/57JJIIJIBackClose?.d?,12.1kP(xk)6,limkkP(xk)=limkP(xk,k)f(xk)=P f=0.12.2S:12.2.1?K?S:S:u?zKmin f(x),x Rn,s.t.gi(x)0,i=1,2,m.(12.10)P1D=x Rn|gi(x)0,i=1,2,m.S:uv?,?g:?zS“:xk1D?S:,1?.?p?/p0N,?S“:C.,O28I,O,/v0,S“:B16/57JJIIJIBackClose?.d,S:SvN,u1?S:8?/,=D0=x Rn|gi(x)
10、0,i=1,2,m 6=.aqu?v,I?EXe?O28IH(x,)=f(x)+H(x),:0vvf;H(x)N.H(x)IvXe5:?x3D0u.,?kgi(x)u0,?H(x)u.k?H(x),dCarrall31961cJ?N,=H(x)=mXi=11gi(x);(12.11)17/57JJIIJIBackClose,dFrisch31955cJ?N,=H(x)=mXi=1lngi(x).(12.12)?,?x3D0,H(x)k?;?x?C.,H(x)+,l?O28I?u,d,?-?/v0.du?zK?4?:31?.?,d,?v?vfk+,S:?vfKk 0.u,)K(12.10)=z)
11、S?zfKmin H(x,k)=f(x)+kH(x).(12.13)uN,=/?JQ?e?.18/57JJIIJIBackClose12.3S:)?zKmin f(x)=x,s.t.x+1 0.)e?H(x)=1x+1,KA?O28IH(x,)=x+x+1.-dH(x,)dx=1(x+1)2=0.?x()=1.(12.14)-0+,kx()1=x.19/57JJIIJIBackClosee?H(x)=ln(x+1),KA?O28IH(x,)=x ln(x+1).-dH(x,)dx=1 x+1=0.?x()=1.(12.15)-0+,kx()1=x.AX2.?(12.14)(12.15),w,(
12、12.15)?x()x?(12.14).(u.d,(12.12)N.?K?,fK20/57JJIIJIBackClose2S:?A.minH(x,)?)L5,?v 0?4?K?4?:.5,u?E,?K,U5fK?Cq?4?:.eS:?.21/57JJIIJIBackClose12.2(S:)0,:x0 D0,?0 6?1.1 0,%(0,1).-k:=1.1,xk1:)?fK(12.13),?4?:xk.2,ekH(xk)6,x xk?K?Cq4?:;K,=3.3,-k+1:=%k,k:=k+1,=1.5 d12.2w,S:?:(?,A5r.?XS“L?1,vkC?5?,u,?O28I?5?5
13、?-,?fK?)5?y?(J,S“?”.d?,S:?:x0?1:,5,?,$(J?.22/57JJIIJIBackCloseeS:?5.kwe?n.n12.2?S?xkd12.2?),zxk?fK(12.13)?4?:.oO28IS?H(xk,k)Ne?,=H(xk+1,k+1)6 H(xk,k).y5?xk+1H(x,k+1)?4?:,dkk+16 k,?H(xk+1,k+1)=f(xk+1)+k+1H(xk+1)6 f(xk)+k+1H(xk)6 f(xk)+kH(xk)=H(xk,k).y.?23/57JJIIJIBackClosee?n?12.2?5.n12.2?f(x)3D3?4?:
14、xS:8D06=.(xk,k)d12.2?)?S?.exkH(x,k)?4?:k 0,oxk?:xK(12.10)?4?:.y dn?,kxk D0 Dxf(x)3D?4?:.l?f(x)6 f(xk)6 H(xk,k),=S?H(xk,k)ke.udn12.2limkH(xk,k)3,”PH.eyH=f(x).,w,kf(x)6 H.eIyH6 f(x).df(x)?Y5,u?0,3 0,?vk x xk 6?x D0,kf(x)f(x)k0,kkH(x)6.5?xkH(x,k)?4?:,=kH(xk,k)6 H(x,k).l?kH(xk,k)f(x)6 H(x,k)f(x)=f(x)f(x
15、)+kH(x)0,i I=1,2,m(12.16)S:A?v.u?|/?v0?g,?u?K|/N0?g,?EO28IH(x,)=f(x)+12lXi=1h2i(x)+mXi=11gi(x),(12.17)26/57JJIIJIBackCloseH(x,)=f(x)+12lXi=1h2i(x)mXi=1lngi(x).(12.18)uaquS:?v?eA?.?dd?:?E,(J?K.,tCyi,i=1,2,m,K?d/=zmin f(x),x Rn,s.t.hi(x)=0,i=1,2,l,gi(x)yi=0,i=1,2,m,yi 0,i=1,2,m.(12.19)27/57JJIIJIBackC
16、lose,?E?dK(12.19)?O28I(x,y,)=f(x)+12lXi=1h2i(x)+12mXi=1?gi(x)yi?2+mXi=11yi,(12.20)(x,y,)=f(x)+12lXi=1h2i(x)+12mXi=1?gi(x)yi?2 mXi=1lnyi.(12.21)3d:,aquc?vS:?e,A?).?,d,?x,y(y 0)?:5A?S“.28/57JJIIJIBackClose12.3ffPowellHestenesu1969c?zKJ?z,?u1973cRockfellar2?)?zK.?g:l?K?.KFu,2?v,l?K=z)X?zfK.du?v?vk+,d,O
17、28IC?/?5?0.O28I?5?v?:,?3fdu.KF9?v?k?/.29/57JJIIJIBackClose12.3.1?K?f?zKmin f(x),x Rn,s.t.h(x)=0,(12.22):h(x)=?h1(x),h2(x),hl(x)?T.P1D=x Rn|h(x)=0,KK(12.22)?.KFL(x,)=f(x)Th(x),:=(1,2,l)Tf.?(x,)K(12.22)?KKT,Kd5kxL(x,)=0,L(x,)=h(x)=0.30/57JJIIJIBackClosed?,Juy,u?x D,kL(x,)=f(x)6 f(x)=f(x)()Th(x)=L(x,).
18、L,ef,KK(12.22)?d/=zmin L(x,),x Rn,s.t.h(x)=0.(12.23)?v)K(12.23),O28I(x,)=L(x,)+2kh(x)k2.y,?0?,x(x,)?4?:.dufk?,?e?O28I(x,)=L(x,)+2kh(x)k231/57JJIIJIBackClose=f(x)Th(x)+2kh(x)k2.(12.24)?:k?=,(x,)?4?:x;,?2?UC?,#?x,?v?x.N/,31kgS“?fKmin(x,k,)?4?:xk,Kd?4?7,kx(xk,k,)=f(xk)h(xk)k h(xk)=0.?3?K?KKT(x,)?,kf(x)
19、h(x)=0,h(x)=0.g,Fxk xk ,u?,?fS?k?#k+1=k h(xk).(12.25)32/57JJIIJIBackClosed(12.25)wk?h(xk)0.eyh(xk)=0?O(xk,k)KKT?.n12.3?zKmin(x,k,)=L(x,k)+2kh(x)k2(12.26)?4?:xk,K(xk,k)K(12.22)?KKT?h(xk)=0.y 75w,.ey5.xkK(12.26)?4?:h(xk)=0,K?1:x D=x Rn|h(x)=0,kf(x)=(x,k,)(xk,k,)=f(xk),=xkK(12.22)?4?:.,5?xkK(12.26)33/5
20、7JJIIJIBackClose?-:,?kx(xk,k,)=f(xk)h(xk)k h(xk)=f(xk)h(xk)k=0.LkAuxk?.KFf,=(xk,k)K(12.22)?KKT.y.?u?,)?K(12.22)?f?Xe(duTdPowellHesteneskJ5?,d,PH).12.3(PH)0,:x0 Rn,1 Rl,?0 6?1.1 0,(0,1),1.-k:=1.34/57JJIIJIBackClose1,xk1:)?fKmin(x,k,k)=f(x)Tkh(x)+k2kh(x)k2,(12.27)?4?:xk.2,ekh(xk)k 6,x xk?K?Cq4?:;K,=3.
21、3,-k+1:=k kh(xk).4,ekh(xk)k kh(xk1)k,-k+1:=k;K,k+1:=k.5,-k:=k+1,=1.e?f.35/57JJIIJIBackClose12.4f)?zKmin f(x)=2x21+x1 3x22,s.t.x2=1.)TKAuf?O28I(x,)=2x21+x1 3x22(x2 1)+2(x2 1)2=2x21+?2 3?x22+x1(+)x2+2.-(x,)x1=4x1+1=0,(x,)x2=(6)x2(+)=0.u 6,)ux1x2?g|,?-:x=x1 x2=14+6.36/57JJIIJIBackClose5?x2=1,?=6.l?x=(1
22、4,1)T=x.l12.4uy,fvu,u,?=.eln5y.n12.3?U Rnn,S Rnm,K?vSTx=0?xkxTUx 0?3 0,?,kxT(U+SST)x 0,0 6=x Rn.y 5w,?.5?STx=0,=kxTUx=xTUx+xTSSTx=xT(U+SST)x 0.75.5?,e3 0,?xT(U+SST)x 0,0 6=x Rn,37/57JJIIJIBackCloseK?,kxT(U+SST)x xT(U+SST)x 0,0 6=x Rn.eIy?35.,e?3,K?k,73xkkxkk=1,?xTk(U+kSST)xk6 0.xkk.S?,?7k?fS?(EP?),?
23、4 xk xk=1.K?4,-k?xTU x+limkkkSTxkk26 0.dd7kkSTxkk kST xk=0(K,kkSTxkk2+),xTU x 6 0,75?g.y.?n12.4?zK(12.22)?KKT(x,)v?5(n8.2,K3 0,k?,38/57JJIIJIBackClosexO28I(x,)(d(12.24)?4?:.?,eh(x)=0 x,(x,)?4?:,K xK(12.22)?4?:.y 5?(x,)=L(x,)+2kh(x)k2,F?,?x(x,)=xL(x,)+h(x)h(x),2x(x,)=2xL(x,)+h(x)h(x)T.d?5,zvh(x)Td=0?
24、d 6=0,kdT2xL(x,)d 0.udn12.3,3 0?d 6=0,kdT2x(x,)d=dT2xL(x,)+h(x)h(x)Td 0.39/57JJIIJIBackClose2d?5,xL(x,)=0,h(x)=0.?kx(x,)=0,LO28I(x,)()3x?v?5,?dn1.8,x(x,)?4?:.y?n?1(.ey1?(.eh(x)=0 x,(x,)?4?:,K?xC?1:x(=h(x)=0),k(x,)6(x,).h(x)=h(x)=0,?k(x,)=f(x),(x,)=f(x).L,u x?,?1:x,kf(x)6 f(x),=xK(12.22)?4?:.y.?40/57
25、JJIIJIBackClose12.3.2?K?fek?zK?f:min f(x),x Rn,s.t.hi(x)=0,i=1,2,l,gi(x)0,i=1,2,m.(12.28)?g:r)?zK?f2?zK,=k?9Cr?z?,?2|5?9C.Q?B,kXek?zKmin f(x),x Rn,s.t.gi(x)0,i=1,2,m.?9Cyi(i=1,2,m),?zK=ze41/57JJIIJIBackClose?d?zKmin f(x),x Rn,s.t.gi(x)y2i=0,i=1,2,m.|12.1),dO2.KF(x,y,)=f(x)mXi=1igi(x)y2i+2mXi=1gi(x)y
26、2i2.?9Cy,uCy?4?z.d?7,-y(x,y,)=0,?2yii 2yigi(x)y2i=0,i=1,2,m,=yiy2i(gi(x)i)=0,i=1,2,m.42/57JJIIJIBackClose?gi(x)i 0,ky2i=1?gi(x)i?=gi(x)i.K,dy2i+i gi(x)0?yi=0.n5,ky2i=gi(x)i,gi(x)i 0,0,gi(x)i6 0,i=1,2,m,=gi(x)y2i=i,gi(x)i 0,gi(x),gi(x)i6 0,i=1,2,m.(12.29)d,?gi(x)i6 0,kigi(x)y2i+2gi(x)y2i2=igi(x)+2gi(
27、x)243/57JJIIJIBackClose=12?(gi(x)i)2 2i?.?gi(x)i 0,kigi(x)y2i+2gi(x)y2i2=12i+122i=122i.n/,kigi(x)y2i+2gi(x)y2i2=12?min0,gi(x)i2 2i?.“?(x,y,),?(x,)=miny(x,y,)=f(x)+12mXi=1?min0,gi(x)i2 2i?.(12.30)u,(12.29)“fS“(k+1)i=(k)igi(xk)(yk)2i,44/57JJIIJIBackClose?(k+1)i=0,gi(xk)(k)i 0,(k)i gi(xk),gi(xk)(k)i6 0
28、,=(k+1)i=max0,(k)i gi(xk)0,i=1,2,m.(12.31)?,(12.29)“OK?mXi=1gi(xk)(yk)2i2?1/26,?mXi=1hminngi(xk),(k)ioi2?1/26.(12.32)y3?E)?zK(12.28)?f.d,O2.KF45/57JJIIJIBackClose(x,)=f(x)lXi=1ihi(x)+2lXi=1h2i(x)+12mXi=1?min0,gi(x)i2 2i?.(12.33)fS“?(k+1)i=(k)i hi(xk),i=1,2,l,(k+1)i=max0,(k)i gi(xk),i=1,2,m.-k=?lXi=1
29、h2i(xk)+mXi=1hminngi(xk),(k)ioi2?1/2,(12.34)KOKk6.46/57JJIIJIBackClosee)?zK(12.28)f?.dudRockfellar3PH?:J?,d,PHR.12.4(PHR)0,x0 Rn,1 Rl,1 Rm,OK0 6?1.1 0,(0,1),1.-k:=1.1,xk1:)?fKmin(x,k,k,k),?4?:xk,(x,k,k,k)d(12.33).2,ek6,kd(12.34),KS“,x xk?K?Cq4?:;K,=3.47/57JJIIJIBackClose3,#f(k+1)i:=(k)i khi(xk),i=1,
30、2,l,(k+1)i:=max0,(k)i kgi(xk),i=1,2,m.4,ek k1,-k+1:=k;K,k+1:=k.5,-k:=k+1,=1.12.4f?MATLABy?!12.4(PHR)?MATLABS,?|TS)?zK.S12.1(PHRS)function x,mu,lam,output=multphr(fun,hf,gf,dfun,dhf,dgf,x0)48/57JJIIJIBackClose%U:f)?zK:%minf(x),s.t.h(x)=0,g(x)=0%:fun,dfunO8I9F,%hf,dhfO?()9Jacobi?=,%gf,dgfO?()9Jacobi?=
31、,%x0:%:xCq),%mu,lamOAu?f,%output(?C,Cq4?f,S“g,SS“g?,%S“gmaxk=1000;%vfsigma=2.0;theta=0.8;eta=2.0;%PHR?k=0;ink=0;%k,inkO?S“SS“g49/57JJIIJIBackCloseepsilon=1e-5;%?x=x0;he=feval(hf,x);gi=feval(gf,x);n=length(x);l=length(he);m=length(gi);%?f?mu=0.1*ones(l,1);lam=0.1*ones(m,1);betak=10;betaold=10;%5u?whi
32、le(betakepsilon&kepsilon%#fmu=mu-sigma*he;lam=max(0.0,lam-sigma*gi);if(k=2&betaktheta*betaold)sigma=eta*sigma;endendk=k+1;betaold=betak;x0=x;end51/57JJIIJIBackClosef=feval(fun,x);output.fval=f;output.iter=k;output.inner_iter=ink;output.beta=betak;%=O2.KF=%function psi=mpsi(x,fun,hf,gf,dfun,dhf,dgf,m
33、u,lam,sigma)f=feval(fun,x);he=feval(hf,x);gi=feval(gf,x);l=length(he);m=length(gi);psi=f;s1=0.0;for(i=1:l)psi=psi-he(i)*mu(i);s1=s1+he(i)2;52/57JJIIJIBackCloseendpsi=psi+0.5*sigma*s1;s2=0.0;for(i=1:m)s3=max(0.0,lam(i)-sigma*gi(i);s2=s2+s32-lam(i)2;endpsi=psi+s2/(2.0*sigma);%=O2.KF?F=%function dpsi=d
34、mpsi(x,fun,hf,gf,dfun,dhf,dgf,mu,lam,sigma)dpsi=feval(dfun,x);he=feval(hf,x);gi=feval(gf,x);dhe=feval(dhf,x);dgi=feval(dgf,x);53/57JJIIJIBackClosel=length(he);m=length(gi);for(i=1:l)dpsi=dpsi+(sigma*he(i)-mu(i)*dhe(:,i);endfor(i=1:m)dpsi=dpsi+(sigma*gi(i)-lam(i)*dgi(:,i);end12.5|S12.1)?zKmin f(x)=3x
35、21 x22 2x23,s.t.x21+x22+x23=3,x2 x1,x1 0.?:x0=(0,0,0)T.54/57JJIIJIBackClose)k?8If1.m:function f=f1(x)f=-3*x(1)2-x(2)2-2*x(3)2;?h1.m:function he=h1(x)he=x(1)2+x(2)2+x(3)2-3;?g1.m:function gi=g1(x)gi=zeros(2,1);gi(1)=-x(1)+x(2);gi(2)=x(1);8I?Fdf1.m:55/57JJIIJIBackClosefunction g=df1(x)g=-6*x(1);-2*x(2
36、);-4*x(3);?Jacobi?=dh1.m:function dhe=dh1(x)dhe=2*x(1),2*x(2),2*x(3);?Jacobi?=dg1.m:function dgi=dg1(x)dgi=-11;1 0;0 0;,?3MATLAB-IXe-:x0=0,0,0;x,mu,lam,output=multphr(f1,h1,g1,df1,dh1,dg1,x0)56/57JJIIJIBackClose?x=1.22471.22470mu=-1.5000lam=1.22470output=fval:-6.0000iter:757/57JJIIJIBackCloseinner_iter:50bta:2.6206e-006