Choose Between optimoptions and optimset
在optimoptions和optimset之间进行选择
原文链接:https://ww2.mathworks.cn/help/optim/ug/optimoptions-and-optimset.html
可使用网页自带的微软翻译进行翻译,加粗表示有二级菜单。
以前, 建议的设置选项的方法是使用optimset。现在的一般建议是使用optimoptions, 下面列出了一些注意事项。
optimset依旧有效, 并且它是为求解器设置选项的唯一方法, 这些选项在没有Optimization Toolbox优化工具箱™许可证的情况下可用: fminbnd、 fminsearch、 fzero和lsqnonneg.
注意
其他一些工具箱使用优化选项, 并要求您传入optimset集 (而不是optimoptions创建的选项。检查工具箱的文档。、
optimoptions通过求解器组织选项, 比optimset更有针对性和更全面的显示:
- 仅创建和修改应用于求解器的选项
- 显示特定算法的选项选择和默认值
- 显示有关求解器选项和其他可用求解器算法的详细信息的链接
intlinprog仅使用optimoptions。
创建选项的主要区别在于:
- 对于optimoptions, 可以将求解器名称作为第一个参数。
options = optimoptions(SolverName,Name,Value,...)
- 对于optimset, 语法不包括求解器名称。
options = optimset(Name,Value,...)
在这两种情况下, 都可以使用点表示法查询或更改选项。请参阅 Set and Change Options设置和更改选项和View Options查看选项.
例如,optimoptions的显示与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: []