Simulated Annealing and Threshold Acceptance Algorithm Options

saoptimset At The Command Line

You specify options by creating an options structure using the function saoptimset, as follows:

options = saoptimset('Param1',value1,'Param2',value2, ...);

See Setting Options for simulannealbnd and threshacceptbnd at the Command Line for examples.

Each option in this section is listed by its field name in the options structure. For example, InitialTemperature refers to the corresponding field of the options structure.

Plot Options

Plot options enable you to plot data from the simulated annealing or threshold acceptance solver while it is running. When you specify plot functions and run the algorithm, a plot window displays the plots on separate axes. Right-click on any subplot to view a larger version of the plot in a separate figure window.

PlotInterval specifies the number of iterations between consecutive calls to the plot function.

To display a plot when calling simulannealbnd or threshacceptbnd from the command line, set the PlotFcns field of options to be a function handle to the plot function. You can specify any of the following plots:

For example, to display the best objective plot, set options as follows

options = saoptimset('PlotFcns',@saplotbestf);

To display multiple plots, use the cell array syntax

options = saoptimset('PlotFcns',{@plotfun1,@plotfun2, ...});

where @plotfun1, @plotfun2, and so on are function handles to the plot functions.

Structure of the Plot Functions

The first line of a plot function has the form

function stop = plotfun(options,optimvalues,flag)

The input arguments to the function are

The output argument stop provides a way to stop the algorithm at the current iteration. stop can have the following values:

Temperature Options

Temperature options specify how the temperature will be lowered at each iteration over the course of the algorithm.

Algorithm Settings

Algorithm settings define algorithmic specific parameters used in generating new points at each iteration.

Parameters that can be specified for the simulated annealing and threshold acceptance algorithms are:

AcceptanceFcn — Function used to determine whether a new point is accepted or not. The default function varies depending on which solver/algorithm you are using. The choices are:

Hybrid Function Options

A hybrid function is another minimization function that runs during or at the end of iterations of the solver. HybridInterval specifies the interval (if not never or end) at which the hybrid function is called. You can specify a hybrid function using the HybridFcn option. The choices are:

You can set a separate options structure for the hybrid function. Use psoptimset or optimset to create the structure, depending on whether the hybrid function is patternsearch or not:

hybridopts = optimset('display','iter','LargeScale','off');

Include the hybrid options in the Simulated Annealing or Threshold Acceptance Algorithm options structure as follows:

options = saoptimset(options,'HybridFcn',{@fminunc,hybridopts}); 

hybridopts must exist before you set options.

See Using a Hybrid Function for an example.

Stopping Criteria Options

Stopping criteria determine what causes the algorithm to terminate. You can specify the following options:

Output Function Options

Output functions are functions that the algorithm calls at each iteration. The default value is to have no output function, []. You must first create an output function using the syntax described in Structure of the Output Function. Then, specify your function as @myfun, where myfun is the name of your function.

If you are using simulanneal, set

options = saoptimset('OutputFcns',@myfun);

To see a template that you can use to write your own output functions, enter

edit saoutputfcntemplate

at the MATLAB command line.

Structure of the Output Function

The output function has the following calling syntax.

[stop,options,optchanged] = myfun(options,optimvalues,flag)

The function has the following input arguments:

The output function returns the following arguments:

Display Options

Use the Display option to specify how much information is displayed at the command line while the algorithm is running. The available options are

Both iter and diagnose display the following information:

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS