版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
本章,我们介绍两种解决非线性规划问题的软件第一种:中的optimizationtoolbox中的若干程序;第二种:LINGO软件.程序名unpfun1函数unpfun2unpfun1实例Minimizethe
f(x)3x22xx 1 在命令窗口输入以下信息>>x0=[1,1];%Thencallfminunctofindaminimumofunpfun1near>>输出以下信息OptimizationterminatedSearchdirectionlessthan2*options.TolXx=1.0e-008 fval=unpfun2实例:将上述的实例用梯度法做>>options=optimset('GradObj','on');%Tominimizethisfunctionwiththegradientprovided>>x0=>>[x,fval]=输出以下信息OptimizationterminatedFirst-orderoptimalitylessthanOPTIONS.TolFun,andnonegative/zerocurvaturedetectedx1.0e-015 fval=第一种fminsearchFindaminimumofanunconstrainedmultivariablewherexisavectorandf(x)isafunctionthatreturnsa语法如下x=x=fminsearch(fun,x0,options)[x,fval]=fminsearch(...)[x,fval,exitflag]=fminsearch(...)[x,fval,exitflag,output]=解释fminsearchattemptstofindaminimumofascalarfunctionofseveralvariables,startingataninitialestimate.Thisisgenerallyreferredtoasunconstrainednonlinearoptimization.x=fminsearch(fun,x0)startsatthepointx0andattemptstofindalocalminimumxofthefunctiondescribedinfun.funisafunctionhandleforeitheranM-filefunctionorananonymousfunction.x0canbeascalar,vector,ormatrix.x=fminsearch(fun,x0,options)minimizeswiththeoptimizationoptionsspecifiedinthestructureoptions.Useoptimsettosetthese[x,fval]=fminsearch(...)returnsinfvalthevalueoftheobjectivefunctionfunatthesolutionx.[x,fval,exitflag]=fminsearch(...)returnsavalueexitflagthatdescribestheexitconditionoffminsearch.[x,fval,exitflag,output]=fminsearch(...)returnsastructureoutputthatcontainsinformationabouttheoptimization.AvoidingGlobalVariablesviaAnonymousandNestedFunctionsex inshowtoparameterizetheobjectivefunctionfun,ifnecessary.第二种:Findaminimumofanunconstrainedmultivariablewherexisavectorandf(x)isafunctionthatreturnsax=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(...)fminuncattemptstofindaminimumofascalarfunctionofseveralvariables,startingataninitialestimate.Thisisgenerallyreferredtoasunconstrainednonlinearoptimization.x=fminunc(fun,x0)startsatthepointx0andattemptstofindalocalminimumxofthefunctiondescribedinfun.x0canbeascalar,vector,orx=fminunc(fun,x0,options)minimizeswiththeoptimizationoptionsspecifiedinthestructureoptions.Useoptimsettosettheseoptions.[x,fval]=fminunc(...)returnsinfvalthevalueoftheobjectivefunctionfunatthesolutionx.[x,fval,exitflag]=fminunc(...)returnsavalueexitflagthatdescribestheexitcondition.[x,fval,exitflag,output]=fminunc(...)returnsastructureoutputthatcontainsinformationabouttheoptimization.[x,fval,exitflag,output,grad]=fminunc(...)returnsingradthevalueofthegradientoffunatthesolutionx.[x,fval,exitflag,output,grad,hessian]=fminunc(...)returnsinhessianthevalueoftheHessianoftheobjectivefunctionfunatthesolutionx.SeeAvoidingGlobalVariablesviaAnonymousandNestedFunctionsex inshowtoparameterizetheobjectivefunctionfun,ifnecessary.程序名cnpfuncnfun实例
fx1x2 0x12x22x3在命令窗口输入以下信息>>A=[-1,-2,->>>>x0=[10;10;10];%Startingguessatthe>>[x,fval]=输出以下信息OptimizationterminatedMagnitudeofdirectionalderivativeinsearchdirectionlessthan2*options.TolFunand umconstraintviolationislessthanoptions.TolConActiveConstraints:x=fval程序的相关知识Findaminimumofaconstrainednonlinearmultivariablesubjectwherex,b,beq,lb,andubarevectors,AandAeqarematrices,c(x)andceq(x)arefunctionsthatreturnvectors,andf(x)isafunctionthatreturnsascalar.f(x),c(x),andceq(x)canbenonlinearfunctions.x=x=x=x=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]=fminconattemptstofindaconstrainedminimumofascalarfunctionofseveralvariablesstartingataninitialestimate.Thisisgenerallyreferredtoasconstrainednonlinearoptimizationornonlinearprogramming.x=fmincon(fun,x0,A,b)startsatx0andattemptstofindaminimumxtothefunctiondescribedinfunsubjecttothelinearinequalitiesA*x<=b.x0canbeascalar,vector,ormatrix.x=fmincon(fun,x0,A,b,Aeq,beq)minimizesfunsubjecttothelinearequalitiesAeq*x=beqaswellasA*x<=b.SetA=[]andb=[]ifnoinequalitiesexist.x=fmincon(fun,x0,A,b,Aeq,beq,lb,ub)definesasetoflowerandupperboundsonthedesignvariablesinx,sothatthesolutionisalwaysintherangelb<=x<=ub.SetAeq=[]andbeq=[]ifnoequalitiesexist.x=fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)subjectstheminimizationtothenonlinearinequalitiesc(x)orequalitiesceq(x)definedinnonlcon.fminconoptimizessuchthatc(x)<=0andceq(x)=0.Setlb=[]and/orub=[]ifnoboundsexist.x=fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)minimizeswiththeoptimizationoptionsspecifiedinthestructureoptions.Useoptimsettosettheseoptions.Setnonlcon=[]iftherearenononlinearinequalityorequalityconstraints.[x,fval]=fmincon(...)returnsthevalueoftheobjectivefunctionfunatthesolutionx.[x,fval,exitflag]=fmincon(...)returnsavalueexitflagthatdescribestheexitconditionoffmincon.[x,fval,exitflag,output]=fmincon(...)returnsastructureoutputwithinformationabouttheoptimization.[x,fval,exitflag,output,lambda]=fmincon(...)returnsastructurelambdawhosefieldscontaintheLagrangemultipliersatthesolutionx.[x,fval,exitflag,output,lambda,grad]=fmincon(...)returnsthevalueofthegradientoffunatthesolutionx.[x,fval,exitflag,output,lambda,grad,hessian]=fmincon(...)returnsthevalueoftheHessianatthesolutionx.SeeHessian.AvoidingGlobalVariablesviaAnonymousandNestedFunctionsexinshowtoparameterizetheobjectivefunctionfun,ifnecessary.程序名qprogramqprogram实例:
f(x)x2x2 42x1x x1,x2在命令窗口输入以下信息theprogramiswiththequadraticPleaseinputtheconstraintsnumberoftheprogrammingm4Pleaseinputthevariantnumberoftheprogrammingn4PleaseinputcostmatrixoftheobjectivefunctionH Pleaseinputcostarrayoftheobjectivefunctionc60PleaseinputthecoefficientmatrixoftheconstraintsA(m,n)=[-2,-1;-1,0;0,-A Pleaseinputtheresourcearrayoftheprogramb(m)_T=[-b00命令窗口输出信息Optimizationterminatedsuccessfully.Thesolutionofthequadraticis:x=程序的相关知识SolvethequadraticprogrammingwhereH,A,andAeqarematrices,andf,b,beq,lb,ub,andxare语法如下x=x=x=x=x=quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options)[x,fval]=quadprog(...)[x,fval,exitflag]=quadprog(...)[x,fval,exitflag,output]=quadprog(...)[x,fval,exitflag,output,lambda]=quadprog(...)解释x=quadprog(H,f,A,b)returnsavectorxthatminimizes1/2*x'*H*x+f'*xsubjecttoA*x<=b.x=quadprog(H,f,A,b,Aeq,beq)solvestheprecedingproblemwhileadditionallysatisfyingtheequalityconstraintsAeq*x=beq.x=quadprog(H,f,A,b,Aeq,beq,lb,ub)definesasetoflowerandupperboundsonthedesignvariables,x,sothatthesolutionisintherangelb<=x<=x=quadprog(H,f,A,b,Aeq,beq,lb,ub,x0)setsthestartingpointtox0.x=quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options)minimizeswiththeoptimizationoptionsspecifiedinthestructureoptions.Useoptimsettosettheseoptions.[x,fva
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《门店目标管理》课件
- 2024年度设备租赁合同:医疗设备的租赁与维护服务
- 《中英文翻译服务》课件
- 粮油购销合同协议书范本
- 个人消费贷款合同
- 消防材料采购合同范本
- 天然气管道安装合同
- 2024年国际贸易实务:创新与实践教案
- 样板间装修合同样板间装修合同范本
- 养老院合作协议
- 2024落实意识形态责任清单及风险点台账
- 13 组装小车 教学设计-2024-2025学年科学一年级上册湘科版
- 低碳生活与绿色文明智慧树知到期末考试答案2024年
- 《中位数与众数》示范课教学课件【数学八年级上册北师大】
- 基于单片机的温度传感器制作
- 10以内加减法口算题(13套100道题-可直接打印)
- 企业中层管理人员绩效考核中存在的问题及对策
- 桩基检测静载试验培训教材ppt课件
- 新教科版五年级上册科学期末试卷
- 汽车维修价格表格模板
- 第七章 行为修正模式
评论
0/150
提交评论