Choose Between optimoptions and optimset


optimoptions

 

Syntax

·        options = optimoptions(SolverName)

·        options =optimoptions(SolverName,Name,Value)

·        options =optimoptions(oldoptions,Name,Value)

·        options =optimoptions(SolverName,oldoptions)

 

SolverName

        fgoalattain 

For relevant name-value pairs, consult the options table for your solver:

Note:   optimoptions is recommended instead of optimset for all solvers except fzerofminbndfminsearch, and lsqnonneg.

 

optimset

Syntax

options =optimset('param1',value1,'param2',value2,...)
optimset

options = optimset
options = optimset(optimfun)
options =optimset(oldopts,'param1',value1,...)
options = optimset(oldopts,newopts) 





Previously, the recommended way to set options was to use optimset. Now the general recommendation is to use optimoptions, with some caveats listed below.

optimset still works, and it is the only way to set options for solvers that are available without an Optimization Toolbox™ license: fminbndfminsearchfzero, and lsqnonneg.

Note

Some other toolboxes use optimization options and require you to pass in options created using optimset, not optimoptions. Check the documentation for your toolboxes.

optimoptions organizes options by solver, with a more focused and comprehensive display than optimset:

  • Creates and modifies only the options that apply to a solver

  • Shows your option choices and default values for a specific solver/algorithm

  • Displays links for more information on solver options and other available solver algorithms

intlinprog uses only optimoptions options.

The main difference in creating options is:

  • For optimoptions, you include the solver name as the first argument.

    options = optimoptions(SolverName,Name,Value,...)
  • For optimset, the syntax does not include the solver name.

    options = optimset(Name,Value,...)

In both cases, you can query or change options by using dot notation. See Set and Change Options and View Options.

For example, compare the display of optimoptions to that of optimset.

options = optimoptions(@fminunc,'SpecifyObjectiveGradient',true)
options = 

  fminunc options:

   Options used by current Algorithm ('trust-region'):
   (Other available algorithms: 'quasi-newton')

   Set properties:
    SpecifyObjectiveGradient: 1

   Default properties:
                   Algorithm: 'trust-region'
              CheckGradients: 0
                     Display: 'final'
    FiniteDifferenceStepSize: 'sqrt(eps)'
        FiniteDifferenceType: 'forward'
           FunctionTolerance: 1.0000e-06
                  HessianFcn: []
          HessianMultiplyFcn: []
      MaxFunctionEvaluations: '100*numberOfVariables'
               MaxIterations: 400
         OptimalityTolerance: 1.0000e-06
                   OutputFcn: []
                     PlotFcn: []
               StepTolerance: 1.0000e-06
         SubproblemAlgorithm: 'cg'
                    TypicalX: 'ones(numberOfVariables,1)'

   Show options not used by current Algorithm ('trust-region')
options = optimset('GradObj','on')
options = 

  struct with fields:

                   Display: []
               MaxFunEvals: []
                   MaxIter: []
                    TolFun: []
                      TolX: []
               FunValCheck: []
                 OutputFcn: []
                  PlotFcns: []
           ActiveConstrTol: []
                 Algorithm: []
    AlwaysHonorConstraints: []
           DerivativeCheck: []
               Diagnostics: []
             DiffMaxChange: []
             DiffMinChange: []
            FinDiffRelStep: []
               FinDiffType: []
         GoalsExactAchieve: []
                GradConstr: []
                   GradObj: 'on'
                   HessFcn: []
                   Hessian: []
                  HessMult: []
               HessPattern: []
                HessUpdate: []
          InitBarrierParam: []
     InitTrustRegionRadius: []
                  Jacobian: []
                 JacobMult: []
              JacobPattern: []
                LargeScale: []
                  MaxNodes: []
                MaxPCGIter: []
             MaxProjCGIter: []
                MaxSQPIter: []
                   MaxTime: []
             MeritFunction: []
                 MinAbsMax: []
        NoStopIfFlatInfeas: []
            ObjectiveLimit: []
      PhaseOneTotalScaling: []
            Preconditioner: []
          PrecondBandWidth: []
            RelLineSrchBnd: []
    RelLineSrchBndDuration: []
              ScaleProblem: []
                   Simplex: []
       SubproblemAlgorithm: []
                    TolCon: []
                 TolConSQP: []
                TolGradCon: []
                    TolPCG: []
                 TolProjCG: []
              TolProjCGAbs: []
                  TypicalX: []
               UseParallel: []

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值