Main Content

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

    example

    opt = sdo.OptimizeOptions creates a default option set for solving a design optimization problem using the sdo.optimize function. To modify the properties of this option set for your specific application, use dot notation.

    example

    opt = sdo.OptimizeOptions(Name,Value) creates an option set with properties specified using one or more name-value arguments.

    Properties

    expand all

    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.

    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.

    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.

    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.

    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.

    Parallel computing option for fmincon, lsqnonlin, and patternsearch optimization solvers, specified as one of the following:

    • false or 0 — Do not use parallel computing during optimization.

    • true or 1 — 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 gradients

    • lsqnonlin — Finite difference gradients

    • patternsearch — 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.

    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'}

    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'}

    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 fastRestart.

    Parallel Computing Toolbox software must be installed to enable parallel optimization.

    Example: Simulator = sdo.SimulationTest('model_demo')

    Object Functions

    sdo.optimizeSolve design optimization problem

    Examples

    collapse all

    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.

    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