ImageVerifierCode 换一换
格式:PPT , 页数:37 ,大小:320.50KB ,
资源ID:2723161      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/2723161.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(第五章(优化设计).ppt)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

第五章(优化设计).ppt

1、第五章第五章 优化设计优化设计5.1 概述(1)无约束优化问题例:(2)约束优化问题(3)线性规划问题目标函数和约束函数都是线性函数的优化问题。(4)多目标规划问题目标函数个数大于1的约束或无约束优化问题5.2 优化问题的求解方法最佳步长a*一般采取数值法求解下降方向d不同方法对应不同优化算法5.3优化问题的matlab求解函数5.3.1 fminunc函数:求无约束目标函数最小值用法:x=fminunc(fun,x0)x=fminunc(fun,x0,options)x,fval=fminunc(.)x,fval,exitflag=fminunc(.)x,fval,exitflag,outp

2、ut=fminunc(.)x,fval,exitflag,output,grad=fminunc(.)x,fval,exitflag,output,grad,hessian=fminunc(.)X:极小点Fval:极小值Fun:目标函数名字X0:初值,列 向量Option:选项Exitflag:=1求解成功,其他值表示不成功Output:保存输出状态的变量Grad:保存梯度计算值的变量Hessian:保存目标函数Hessian矩阵的变量强烈建议使用格式x y exit=fminunc(fun,x0,options)计算设置:op=optimset(MaxIter,10000);op=optim

3、set(op,TolFun,1.e-4);op=optimset(op,TolX,1.e-6);x y exit=fminunc(f2,1;2,op);function f=f2(X)y1=X(1)+cos(X(2);y2=sin(X(1)+X(2)+10;f=y1*y1+y2*y2;原选项名称,对原选项值进行修改Exit flag标志:1:Magnitude of gradient smaller than the specified tolerance.梯度幅度小于给定误差2:Change in x was smaller than the specified tolerance.设计变量

4、X变化小于给定误差3:Change in the objective function value was less than the specified tolerance.目标函数值变化小于给定误差0:Number of iterations exceeded options.MaxIter or number of function evaluations exceeded options.FunEvals.循环次数超出给定值-1:Algorithm was terminated by the output function.失败-2:Line search cannot find an

5、 acceptable point along the current search direction.失败使用fminunc函数时,强烈建议对循环次数、梯度误差、设计变量误差、目标函数误差进行设置。MaxIter:Maximum number of iterations allowed.TolFun:Termination tolerance on the function value.TolX:Termination tolerance on x例:(a)定义目标函数(b)调用fminunc函数(c)根据返回结果,如果计算不成功(可用计算点判断它是否满足约束条件),修改计算选项,直至计算

6、结果满意。5.3.2 线性规划求解函数数学模型:min:cTxs.t:AX=b,b的分量可以小于0 AeqX=beq Aeq:等式约束矩阵;beq:等式约束b向量 lb=X=ub,如果设计变量大于0,需要设置lb=0向量 lb:左边界向量,ub:右边界向量用法:x=linprog(c,A,b)x=linprog(c,A,b,Aeq,beq)x=linprog(c,A,b,Aeq,beq,lb,ub)x=linprog(c,A,b,Aeq,beq,lb,ub,x0)x=linprog(c,A,b,Aeq,beq,lb,ub,x0,options)x,fval=linprog(.)x,fval,e

7、xitflag=linprog(.)x,fval,exitflag,output=linprog(.)x,fval,exitflag,output,lambda=linprog(.)Set Aeq=and beq=if no equalities exist.Set A=and b=if no inequalities exist.Set lb=and ub=if no boudary exist英文Help说第2个参数为Lagrange乘子参数,是错误的,实际上仍为目标函数值1:function converged to a solution x.0:Number of iterations

8、 exceeded options.MaxIter.-2:No feasible point was found.-3:Problem is unbounded.-4:NaN value was encountered during execution of the algorithm.-5:Both primal and dual problems are infeasible.-7:Search direction became too small.No further progress could be made.例:某车间要100套钢架,每套钢架由2.0m,2.1m,1.5m长的钢材各

9、一段组成,现有钢材每条240m,如何分配才能使尾料最少。段数套1套2套3套4套52.9120102.1002211.531203尾料00.10.20.30.42.9x1+5.8x2+2.9x3=2404.2x3+4.2x4+2.1x5=2404.5x1+1.5x2+3x3+4.5x5=0Min0.1x2+0.2x3+0.3x4+0.4x55.3.3 二次规划求解函数quadprog数学模型:x=quadprog(G,q,A,b)x=quadprog(G,q,A,b,Aeq,beq)x=quadprog(G,q,A,b,Aeq,beq,lb,ub)x=quadprog(G,q,A,b,Aeq,b

10、eq,lb,ub,x0)x=quadprog(G,q,A,b,Aeq,beq,lb,ub,x0,options)返回标志:1:Function converged to a solution x.3:Change in the objective function value was smaller than the specified tolerance.4:Local minimizer was found.0:Number of iterations exceeded options.MaxIter.-2:Problem is infeasible.-3:Problem is unbou

11、nded.-4:Current search direction was not a direction of descent.No further progress could be made.-7:Magnitude of search direction became too small.No further progress could be made.x,fval=quadprog(.)x,fval,exitflag=quadprog(.)x,fval,exitflag,output=quadprog(.)x,fval,exitflag,output,lambda=quadprog(

12、.)例:5.3.4 约束优化函数fmincon返回向量的函数用法:x=fmincon(fun,x0,A,b)x=fmincon(fun,x0,A,b,Aeq,beq)x=fmincon(fun,x0,A,b,Aeq,beq,lb,ub)x=fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)x=fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)x,fval=fmincon(.)x,fval,exitflag=fmincon(.)x,fval,exitflag,output=fmincon(.)x,fval,exitf

13、lag,output,lambda=fmincon(.)x,fval,exitflag,output,lambda,grad=fmincon(.)x,fval,exitflag,output,lambda,grad,hessian=fmincon(.)Fun:目标函数Nonlcon:非线性约束函数 注意:(1)Set A=and b=if no inequalities exist(2)Set Aeq=and beq=if no equalities exist.Set lb(i)=-Inf if x(i)is unbounded below,and set ub(i)=Inf if x(i)

14、is unbounded above.(3)set lb=and/or ub=if no bounds exist.(4)Set nonlcon=if there are no nonlinear inequality or equality constraints.(5)inequalities c(x)or equalities ceq(x)is defined in nonlcon.用户不自己定义梯度求解函数时,目标函数定义:function f=myfun(x)f=.%Compute function value at x用户自己定义梯度求解函数,并且选项 GradObj 为 on即定

15、义了选项:options=optimset(GradObj,on)目标函数必须如下定义:function f,g=myfun(x)f=.%Compute the function value at xif nargout 1%fun called with two output arguments g=.%Compute the gradient evaluated at xendif the Hessian matrix can also be computed and the Hessian option is on,i.e.,options=optimset(Hessian,on),目标

16、函数必须如下定义:function f,g,H=myfun(x)f=.%Compute the objective function value at xif nargout 1%fun called with two output arguments g=.%Gradient of the function evaluated at xEndif nargout 2 H=.%Hessian evaluated at xend非线性约束用法:x=fmincon(myfun,x0,A,b,Aeq,beq,lb,ub,mycon)非线性约束必须如下定义:function c,ceq=mycon(x)c=.%Compute nonlinear inequalities at x.ceq=.%Compute nonlinear equalities at x.如果选项 GradConstr设置 为 on,as set byoptions=optimset(GradConstr,on)非线性约束函数必须如下定义:无不等式约束时,使用语句C=;或使用Ceq=function c,ceq,GC,GC

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1