sdo.OptimizeOptions
Optimization option set for sdo.optimize
function
Description
Use an sdo.OptimizeOptions
object to specify options for solving
a design optimization problem using the sdo.optimize
function. You can specify options such as a solver method, solver
options, and the use of parallel computing during optimization.
Creation
Description
creates a default
option set for solving a design optimization problem using the opt
= sdo.OptimizeOptionssdo.optimize
function. To modify the properties of this option set for your
specific application, use dot notation.
creates an option set with properties
specified using one or more name-value arguments.opt
= sdo.OptimizeOptions(Name,Value
)
Properties
Method
— Optimization solver
'fmincon'
(default) | 'fminsearch'
| 'lsqnonlin'
| 'patternsearch'
| 'surrogateopt'
Optimization solver that sdo.optimize
uses to solve the optimization
problem, specified as one of the following values:
'fmincon'
— Default for design optimization, derivative based method, allows nonlinear constraints and parameter bounds.'fminsearch'
— Derivative-free method.'lsqnonlin'
— Default for parameter estimation. This method works with gradient of residual between model output and data. This method allows nonlinear constraints (since R2023b) and parameter bounds.'patternsearch'
— Derivative-free method. This method allows nonlinear constraints and parameter bounds. Pattern search requires Global Optimization Toolbox software.'surrogateopt'
— Surrogate-based method. This method allows nonlinear constraints and discrete-valued parameters. The method requires parameter bounds. Using surrogate-based optimization requires Global Optimization Toolbox software.
See the Optimization Toolbox™ and Global Optimization Toolbox documentation for more information on these solvers.
MethodOptions
— Optimization solver options
[1x1 optim.options.Fmincon]
(default) | options object created using optimoptions
Optimization solver options, specified as an optimization options object, created
using optimoptions
. The options are configured based on the
Method
property. Because 'fmincon'
is the
default optimization solver method, the default value for this property is an
optimoptions
object for fmincon
solver. For
information about the available optimization solver options, consult the options table
for your solver based on the Method
specified:
To modify the solver options, use dot notation. For example,
opt.MethodOptions.StepTolerance = 1.5e-3
.
Restarts
— Number of times to restart optimization
0
(default) | nonnegative integer
Number of times to restart optimization if convergence criteria are not satisfied, specified as a nonnegative integer. At each restart, the initial values of the tunable parameters are set to the final value of the previous optimization run.
StopIfFeasible
— Option to stop optimization once feasible solution is found
'on'
(default) | 'off'
Option to stop optimization once a feasible solution satisfying constraints is found, specified as one of the following values:
'on'
— Terminate as soon a feasible solution is found.'off'
— Continue to search for solutions that are typically located further inside the constraint region.
The software ignores this option when you track a reference signal or your problem has a cost.
GradFcn
— Option to return gradient information from cost or constraint function
'off'
(default) | 'on'
Option to specify that the cost or constraint function you provide to
sdo.optimize
provides gradient information, specified as one of
the following values:
'off'
— Your cost or constraint function does not provide gradient information. The software uses central differences to compute the gradients.'on'
— Your cost or constraint function provides gradient information as one of its output arguments.
UseParallel
— Parallel computing option
false
or 0
(default) | true
or 1
Parallel computing option for fmincon
,
lsqnonlin
, and patternsearch
optimization
solvers, specified as one of the following:
false
or0
— Do not use parallel computing during optimization.true
or1
— Use parallel computing during optimization.
Parallel Computing Toolbox™ software must be installed to enable parallel computing for the optimization methods.
When set to true
, the methods compute the following in parallel:
fmincon
— Finite difference gradientslsqnonlin
— Finite difference gradientspatternsearch
— Poll and search set evaluation
Note
Parallel computing is not supported for fminsearch
.
For parallel computing, specify a simulation scenario for the Simulink® model to optimize as an sdo.SimulationTest
object in the OptimizedModel
property. You can specify model file dependencies in the
ParallelFileDependencies
property, or you can specify paths to
dependencies in the ParallelPathDependencies
property, if
needed.
ParallelFileDependencies
— File dependencies to use during parallel optimization
{}
(default) | cell array of character vectors
File dependencies to use during parallel optimization, specified as a cell array of
character vectors. Each character vector can specify either an absolute or relative path
to a file. These files are copied to the workers during parallel optimization. Use
sdo.getModelDependencies
to find the
dependencies of a Simulink model.
Example: opt.ParallelFileDependencies =
{'C:\matlab\work\file1.m','C:\matlab\myProject\file2.m'}
ParallelPathDependencies
— Paths to dependencies to use during parallel optimization
{}
(default) | cell array of character vectors
Paths to dependencies to use during parallel optimization, specified as a cell array
of character vectors. If you do not want to copy the files to workers, use this property
instead of the ParallelFileDependencies
property. These path
dependencies are temporarily added to the workers during parallel optimization. Use
sdo.getModelDependencies
to find the
dependencies of a Simulink model.
Example: opt.ParallelPathDependencies =
{'C:\matlab\work','C:\matlab\myProject'}
OptimizedModel
— Name of Simulink model to optimize
''
(default) | sdo.SimulationTest
object | character vector
Name of Simulink model to optimize, specified as either an sdo.SimulationTest
object or a character vector with the name of the
model.
Specify OptimizedModel
as an sdo.SimulationTest
object when using both parallel optimization
(UseParallel = true
) and fast restart.
Parallel Computing Toolbox software must be installed to enable parallel optimization.
Example: Simulator =
sdo.SimulationTest('model_demo')
Object Functions
sdo.optimize | Solve design optimization problem |
Examples
Create Default Optimization Options Object
Create a default sdo.OptimizeOptions
option set.
opt = sdo.OptimizeOptions;
Specify options using dot notation.
opt.Method = 'lsqnonlin'; opt.GradFcn = 'on';
Any property values you do not specify remain at their default values.
Specify Optimization Solver
Create an option set object that specifies nonlinear least-squares optimization solver as its solving method.
opt = sdo.OptimizeOptions('Method','lsqnonlin')
opt = OptimizeOptions with properties: Method: 'lsqnonlin' MethodOptions: [1x1 optim.options.Lsqnonlin] Restarts: 0 StopIfFeasible: 'on' GradFcn: 'off' UseParallel: 0 ParallelPathDependencies: {} ParallelFileDependencies: {} OptimizedModel: ''
You can modify solver options using dot notation. For example, set the solver algorithm to the Levenberg-Marquardt method.
opt.MethodOptions.Algorithm = 'levenberg-marquardt';
View the method options.
opt.MethodOptions
ans = lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'interior-point', 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' Display: 'iter' FunctionTolerance: 1.0000e-03 MaxFunctionEvaluations: Inf MaxIterations: 100 SpecifyObjectiveGradient: 1 StepTolerance: 1.0000e-03 Default properties: FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' OutputFcn: [] PlotFcn: [] TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Options not used by current Algorithm ('levenberg-marquardt') Set properties: ConstraintTolerance: 1.0000e-03 OptimalityTolerance: 1.0000e-03 SpecifyConstraintGradient: 0 Default properties: BarrierParamUpdate: 'monotone' JacobianMultiplyFcn: [] SubproblemAlgorithm: 'factorization'
Any property values you do not specify remain at their default values.
Version History
Introduced in R2011a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)