Main Content

saoptimset

(Not recommended) Create simulated annealing options structure

saoptimset is not recommended. Use optimoptions instead. For more information, see Compatibility Considerations.

Syntax

saoptimset
options = saoptimset
options = saoptimset('param1',value1,'param2',value2,...)
options = saoptimset(oldopts,'param1',value1,...)
options = saoptimset(oldopts,newopts)
options = saoptimset('simulannealbnd')

Description

saoptimset with no input or output arguments displays a complete list of parameters with their valid values.

options = saoptimset (with no input arguments) creates a structure called options that contains the options, or parameters, for the simulated annealing algorithm, with all parameters set to [].

options = saoptimset('param1',value1,'param2',value2,...) creates a structure options and sets the value of 'param1' to value1, 'param2' to value2, and so on. Any unspecified parameters are set to []. It is sufficient to type only enough leading characters to define the parameter name uniquely. Case is ignored for parameter names. Note that for character values, correct case and the complete value are required.

options = saoptimset(oldopts,'param1',value1,...) creates a copy of oldopts, modifying the specified parameters with the specified values.

options = saoptimset(oldopts,newopts) combines an existing options structure, oldopts, with a new options structure, newopts. Any parameters in newopts with nonempty values overwrite the corresponding old parameters in oldopts.

options = saoptimset('simulannealbnd') creates an options structure with all the parameter names and default values relevant to 'simulannealbnd'. For example,

saoptimset('simulannealbnd')

ans = 
          AnnealingFcn: @annealingfast
        TemperatureFcn: @temperatureexp
         AcceptanceFcn: @acceptancesa
                TolFun: 1.0000e-006
        StallIterLimit: '500*numberofvariables'
           MaxFunctionEvaluations: '3000*numberofvariables'
             TimeLimit: Inf
         MaxIterations: Inf
        ObjectiveLimit: -Inf
               Display: 'final'
       DisplayInterval: 10
             HybridFcn: []
        HybridInterval: 'end'
              PlotFcns: []
          PlotInterval: 1
            OutputFcns: []
    InitialTemperature: 100
      ReannealInterval: 100
              DataType: 'double'

Options

The following table lists the options you can set with saoptimset. See Simulated Annealing Options for a complete description of these options and their values. Values in {} denote the default value. You can also view the options parameters by typing saoptimset at the command line.

optimoptions hides the options listed in italics, but saoptimset does not. See Options that optimoptions Hides.

OptionDescriptionValues

AcceptanceFcn

Function the algorithm uses to determine if a new point is accepted. Specify as 'acceptancesa' or a function handle.

Function handle | {'acceptancesa'}

AnnealingFcn

Function the algorithm uses to generate new points. Specify as a name of a built-in annealing function or a function handle.

Function handle | function name | 'annealingboltz' | {'annealingfast'}

DataType

Type of decision variable

'custom' | {'double'}

Display

Level of display

'off' | 'iter' | 'diagnose' | {'final'}

DisplayInterval

Interval for iterative display

Positive integer | {10}

FunctionTolerance

Termination tolerance on function value

For an options structure, use TolFun.

Nonnegative scalar | {1e-6}

HybridFcn

Automatically run HybridFcn (another optimization function) during or at the end of iterations of the solver. Specify as a name or a function handle.

See When to Use a Hybrid Function.

'fminsearch' | 'patternsearch' | 'fminunc' | 'fmincon' | {[]}

or

1-by-2 cell array | {@solver, hybridoptions}, where solver = fminsearch, patternsearch, fminunc, or fmincon {[]}

HybridInterval

Interval (if not 'end' or 'never') at which HybridFcn is called

Positive integer | 'never' | {'end'}

InitialTemperature

Initial value of temperature

Nonnegative scalar | positive vector | {100}

MaxFunctionEvaluations

Maximum number of objective function evaluations allowed

For an options structure, use MaxFunEvals.

Nonnegative integer | {3000*numberOfVariables}

MaxIterations

Maximum number of iterations allowed

For an options structure, use MaxIter.

Nonnegative integer | {Inf}

MaxStallIterations

Number of iterations over which average change in fitness function value at current point is less than options.FunctionTolerance

For an options structure, use StallIterLimit.

Nonnegative integer | {500*numberOfVariables}

MaxTime

The algorithm stops after running for MaxTime seconds

For an options structure, use TimeLimit.

Nonnegative scalar | {Inf}

ObjectiveLimit

Minimum objective function value desired

Scalar | {-Inf}

OutputFcn

Function(s) get(s) iterative data and can change options at run time

For an options structure, use OutputFcns.

Function handle | cell array of function handles | {[]}

PlotFcn

Plot function(s) called during iterations

For an options structure, use PlotFcns.

Function handle | built-in plot function name | cell array of function handles | cell array of built-in plot function names | 'saplotbestf' | 'saplotbestx' | 'saplotf' | 'saplotstopping' | 'saplottemperature' | {[]}

PlotInterval

Plot functions are called at every interval

Positive integer | {1}

ReannealInterval

Reannealing interval

Nonnegative integer | {100}

TemperatureFcn

Function used to update temperature schedule

Function handle | built-in temperature function name | 'temperatureboltz' | 'temperaturefast' | {'temperatureexp'}

Version History

Introduced in R2007a

collapse all

R2018b: saoptimset is not recommended

To set options, the gaoptimset, psoptimset, and saoptimset functions are not recommended. Instead, use optimoptions.

The main difference between using optimoptions and the other functions is that you include the solver name as the first argument in optimoptions. For example, to set an iterative display in ga:

options = optimoptions('ga','Display','iter');
% instead of
options = gaoptimset('Display','iter');

The other difference is that some option names have changed. You can continue to use the old names in optimoptions. For details, see Options Changes in R2016a.

optimoptions offers these advantages over the other functions:

  • optimoptions provides better automatic code suggestions and completions, especially in the Live Editor.

  • You can use a single option-setting function instead of a variety of functions.

There are no plans to remove gaoptimset, psoptimset, and saoptimset at this time.