已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第四章 非线性规划本章, 我们介绍两种解决非线性规划问题的软件:第一种: MATLAB 中的 optimization toolbox 中的若干程序;第二种: LINGO 软件.1MATLAB 程序说明1.1 无约束问题程序名: unpfun1 函数, unpfun2 函数unpfun1 实例:Minimize the function 221()3fxx在命令窗口输入以下信息: x0=1,1; % Then call fminunc to find a minimum of unpfun1 near 1,1 x,fval=fminunc(unpfun1,x0)输出以下信息:Optimization terminated successfully:Search direction less than 2*options.TolXx =1.0e-008 *-0.7591 0.2665fval =1.3953e-016unpfun2 实例:将上述的实例用梯度法做在命令窗口输入以下信息: options = optimset(GradObj,on); % To minimize this function with the gradient provided x0 = 1,1; x,fval = fminunc(unpfun2,x0,options)输出以下信息:Optimization terminated successfully:First-order optimality less than OPTIONS.TolFun, and no negative/zero curvature detectedx =1.0e-015 *0.1110 -0.8882fval =6.2862e-031程序的相关知识:第一种: fminsearchFind a minimum of an unconstrained multivariable functionwhere x is a vector and f(x) is a function that returns a scalar.语法如下:x = fminsearch(fun,x0)x = fminsearch(fun,x0,options)x,fval = fminsearch(.)x,fval,exitflag = fminsearch(.)x,fval,exitflag,output = fminsearch(.)解释:fminsearch attempts to find a minimum of a scalar function of several variables, starting at an initial estimate. This is generally referred to as unconstrained nonlinear optimization.x = fminsearch(fun,x0) starts at the point x0 and attempts to find a local minimum x of the function described in fun. fun is a function handle for either an M-file function or an anonymous function. x0 can be a scalar, vector, or matrix.x = fminsearch(fun,x0,options) minimizes with the optimization options specified in the structure options. Use optimset to set these options. x,fval = fminsearch(.) returns in fval the value of the objective function fun at the solution x.x,fval,exitflag = fminsearch(.) returns a value exitflag that describes the exit condition of fminsearch.x,fval,exitflag,output = fminsearch(.) returns a structure output that contains information about the optimization.Avoiding Global Variables via Anonymous and Nested Functions explains how to parameterize the objective function fun, if necessary.第二种: fminuncFind a minimum of an unconstrained multivariable functionwhere x is a vector and f(x) is a function that returns a scalar.语法如下:x = fminunc(fun,x0)x = fminunc(fun,x0,options)x,fval = fminunc(.)x,fval,exitflag = fminunc(.)x,fval,exitflag,output = fminunc(.)x,fval,exitflag,output,grad = fminunc(.)x,fval,exitflag,output,grad,hessian = fminunc(.)解释:fminunc attempts to find a minimum of a scalar function of several variables, starting at an initial estimate. This is generally referred to as unconstrained nonlinear optimization.x = fminunc(fun,x0) starts at the point x0 and attempts to find a local minimum x of the function described in fun. x0 can be a scalar, vector, or matrix. x = fminunc(fun,x0,options) minimizes with the optimization options specified in the structure options. Use optimset to set these options. x,fval = fminunc(.) returns in fval the value of the objective function fun at the solution x.x,fval,exitflag = fminunc(.) returns a value exitflag that describes the exit condition.x,fval,exitflag,output = fminunc(.) returns a structure output that contains information about the optimization.x,fval,exitflag,output,grad = fminunc(.) returns in grad the value of the gradient of fun at the solution x.x,fval,exitflag,output,grad,hessian = fminunc(.) returns in hessian the value of the Hessian of the objective function fun at the solution x. See Hessian.Avoiding Global Variables via Anonymous and Nested Functions explains how to parameterize the objective function fun, if necessary.1.2 有约束的非线性规划程序名: cnpfun 函数cnfun 实例 : 123mins.t072fx 在命令窗口输入以下信息: A=-1,-2,-2;1,2,2; b=0;72; x0 = 10; 10; 10; % Starting guess at the solution x,fval = fmincon(cnpfun,x0,A,b)输出以下信息:Optimization terminated successfully:Magnitude of directional derivative in search direction less than 2*options.TolFun and maximum constraint violation is less than options.TolConActive Constraints:2x =24.000012.000012.0000fval =-3456程序的相关知识:Find a minimum of a constrained nonlinear multivariable function subject to where x, b, beq, lb, and ub are vectors, A and Aeq are matrices, c(x) and ceq(x) are functions that return vectors, and f(x) is a function that returns a scalar. f(x), c(x), and ceq(x) can be nonlinear functions.语法如下: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,exitflag,output,lambda = fmincon(.)x,fval,exitflag,output,lambda,grad = fmincon(.)x,fval,exitflag,output,lambda,grad,hessian = fmincon(.)解释:fmincon attempts to find a constrained minimum of a scalar function of several variables starting at an initial estimate. This is generally referred to as constrained nonlinear optimization or nonlinear programming.x = fmincon(fun,x0,A,b) starts at x0 and attempts to find a minimum x to the function described in fun subject to the linear inequalities A*x =0;x1+2*x2+2*x3=72;按运行按钮在 solution report 窗口得到以下结果:Local optimal solution found at iteration: 56Objective value: -3456.000Variable Value Reduced CostX1 24.00000 0.000000X2 12.00000 -0.1217727E-06X3 12.00000 -0.1198846E-06Row Slack or Surplus Dual Price1 -3456.000 -1.0000002 72.00000 0
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年鼠抗人T淋巴细胞单克隆抗体合作协议书
- 初中生物实验教学设计与课堂演示
- 初中科学教师学期教学总结范本与技巧
- 高一化学(人教版)导学案必修一第二章单元整体教学设计与阶段验收评价
- 数字化转型战略规划报告范本
- 地面嵌入式展示平台创新创业项目商业计划书
- 搪瓷日用品媒体深度合作创新创业项目商业计划书
- 医院陪护床垫创新创业项目商业计划书
- 农作物智能种植与收获自动化创新创业项目商业计划书
- 2026届汇文中学化学高三第一学期期中复习检测试题含解析
- 2026届高三上学期华师联盟联考10月月考英语试卷
- 2025年产前筛查咨询试题及答案
- 《九章》原文及译文
- 施工应急救援预案模板
- 儿科口腔护理知识培训课件
- 2025年加油站经理招聘面试高频问题清单及参考答案
- 化验员职业健康知识培训
- 2025军队三大条令试题及答案
- 2025至2030中国聚烯烃弹性体(POE)行业市场深度调研及发展策略与投资机会报告
- 2025四川成都交通投资集团有限公司招聘6人笔试参考题库附带答案详解
- 2025年高考地理山东卷试卷评析及备考策略(课件)
评论
0/150
提交评论