北京工业大学 最优化基础实验:使用matlab求解规划问题_第1页
北京工业大学 最优化基础实验:使用matlab求解规划问题_第2页
北京工业大学 最优化基础实验:使用matlab求解规划问题_第3页
北京工业大学 最优化基础实验:使用matlab求解规划问题_第4页
北京工业大学 最优化基础实验:使用matlab求解规划问题_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、北京工业大学最优化基础实验:使用matlab求解规划问题 实验一非线性最优化方法实验min f (x)二 x2 + x2 4x 4x + 81. 1 2 1 2s.t: x + 2x 4 f=(x)x(1)A2+x(2F2-4*x(1)-4*x(2)+8; A=1,2b=4A =12 b =4 x,fval=fmincon(f,10,10,A,b) x =1.6000 1.2000 fval =0.8000min f (x) = x 2 + x 2 + x 2 一 (2x + 4x + 6x )1 2 3 1 2 3解: apple=(x)x(1)A2+x (2) A2+x(3)A2-(2*x

2、(1)+4*x(2)+6*x(3)apple =(x)x(1)A2+x(2)A2+x(3)A2-(2*x(1)+4*x(2)+6*x(3) x,fval=fminunc(apple,1,1,4)Warning: Gradient must be provided for trust-region algorithm; using line-search algorithm instead. In fminunc at 341Local minimum found.Optimization completed because the size of the gradient is less th

3、an the default value of the function tolerance.x =1.0000 2.0000 3.0000fval =-14min f (x)二 xs.t: (1 x )3 x 0 12x,x 012解 f3=(x)x(1)f3 =(x)x(1)lb=zeros(2,1)lb =00 x0=1,1x0 = x,optimal=fmincon(objfun,x0,lb,nonlcon)Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlinineqnonlin12x

4、=00 optimal =0min f (x)二(x 3)2 + (x 3)212s.t: 4 x x 012x , x 012 f4=(x)(x(1)-3)A2+(x(2)-3F2f4 =(x)(x(1)-3)A2+(x(2)-3)A2 A=1,1A = b=4lb=zeros(2,1)lb =00 x,fval=fmincon(f4,10,10,A,b,lb,)Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You coul

5、d also trythe interior-point or sqp algorithms: set the Algorithm option to interior-point or sqp and rerun. For more help, seeChoosing the Algorithm in the documentation. In fmincon at 472Local minimum found that satisfies the constraints.Optimization completed because the objective function is non

6、-decreasing in feasible directions, to within the default value of the function tolerance, and constraints are satisfied to within the default value of the constraint tolerance.Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlinineqnonlin1x =2.0000 2.0000fval =2.0000min f (x

7、)二(x 2)2 + (x 2)25. 1 2s.t: x + x 6 二 012本题要求输出寻优过程的迭代次数。解: f5=(x)(x(1)-2)A2+(x(2)-2F2f5 =(x)(x(1)-2)A2+(x(2)-2)A2Aeq=1,1Aeq =11beq=6beq =6options=optimset(Display,iter) options =Display: iter MaxFunEvals: MaxIter: TolFun: TolX: FunValCheck: OutputFcn: PlotFcns: ActiveConstrTol: Algorithm: AlwaysHon

8、orConstraints: BranchStrategy: DerivativeCheck: Diagnostics: DiffMaxChange: DiffMinChange: FinDiffType: GoalsExactAchieve: GradConstr: GradObj: HessFcn: Hessian: HessMult: HessPattern: HessUpdate: InitialHessType: InitialHessMatrix: InitBarrierParam: InitTrustRegionRadius: Jacobian: JacobMult: Jacob

9、Pattern: LargeScale: LevenbergMarquardt: LineSearchType: MaxNodes: MaxPCGIter: MaxProjCGIter: MaxRLPIter: MaxSQPIter: MaxTime: MeritFunction: MinAbsMax: NodeDisplayInterval: NodeSearchStrategy: NonlEqnAlgorithm: NoStopIfFlatInfeas: ObjectiveLimit: PhaseOneTotalScaling: Preconditioner: PrecondBandWid

10、th: RelLineSrchBnd: RelLineSrchBndDuration: ScaleProblem: Simplex: SubproblemAlgorithm: TolCon: TolConSQP: TolGradCon: TolPCG: TolProjCG: TolProjCGAbs: TolRLPFun: TolXInteger: TypicalX: UseParallel: x,fval=fmincon(f5,1,3,Aeq,beq,options)Warning: Trust-region-reflective algorithm does not solve this

11、type of problem, using active-set algorithm. You could also trythe interior-point or sqp algorithms: set the Algorithm option to interior-point or sqp and rerun. For more help, seeChoosing the Algorithm in the documentation. In fmincon at 472Max Line search Directional First-orderIter F-countf(x)con

12、straint steplength derivativeoptimality Procedure03 2 2Infeasible start point1648.882e-0161-2.535292.0246901-2.833.78312201-0.3144Local minimum found that satisfies the constraints.Optimization completed because the objective function is non-decreasing in feasible directions, to within the default v

13、alue of the function tolerance, and constraints are satisfied to within the default value of the constraint tolerance.x =3.0000 3.0000fval =实验二线性规划a )min f (x) = x + 2 x12s.t: x + x 212x + x 112x 012解: f=1,2f =12 A=-1,-11,-10,1A =-1 -11 -101 b=-2;-1;3b =-2-13lb =00 x,fval=linprog(f,A,b,lb) Optimizat

14、ion terminated.x =0.50001.5000fval =3.5000min f (x) = -x + 2x - 3x123s.t: x + x + x = 6123x + x + 2 x = 41232 x + 3x = 1023x 0123解: f=-1,2,-3f =-12-3 A=0,0,1A = b=2aeq=1,1,1,-1,1,20,2,3aeq =111-1 1 2023beq=6;4;10beq =6410 lb=zeros(3,1)lb =000 x,fval=linprog(f,A,b,aeq,beq,lb)Optimization terminated.x =2.00002.00002.0000fval =min f (x) = -2x - 5x12s.t: x + 2 x 812x 41x 012解: f=-2,-5f =-2-5 A=1,21,00,1A =121001 b=8;4;3b =843lb=zeros(2,1)lb =00 x,fval=linprog(f,A,b,lb)Optimization terminated.2.00003.0000fval =-19

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论