To call the simulated annealing function at the command line, use the syntax
[x fval] = simulannealbnd(@objfun,x0,lb,ub,options)
@objfun is a function handle to
the objective function.
x0 is an initial guess for the
lower and upper bound constraints, respectively, on
options is a structure containing
options for the algorithm. If you do not pass in this argument,
its default options.
The results are given by:
x — Final point returned
by the solver
fval — Value of the objective
The command-line function
convenient if you want to
Return results directly to the MATLAB® workspace.
Run the simulated annealing algorithm multiple times
with different options by calling
Command Line Simulated Annealing Optimization provides
a detailed description of using the function
creating the options structure.
To open the Optimization app, enter
optimtooland then choose
simulannealbndfrom the Solver menu.
You can also start the tool from the MATLAB Apps tab.
To use the Optimization app, you must first enter the following information:
Objective function — The
objective function you want to minimize. Enter the fitness function
in the form
a file that computes the objective function. Compute Objective Functions explains how write this file.
@ sign creates a function handle to
Number of variables —
The length of the input vector to the fitness function. For the function
in Compute Objective Functions,
you would enter
You can enter bounds for the problem in the Constraints pane. If the problem is unconstrained, leave these fields blank.
To run the simulated annealing algorithm, click the Start button. The tool displays the results of the optimization in the Run solver and view results pane.
You can change the options for the simulated annealing algorithm in the Options pane. To view the options in one of the categories listed in the pane, click the + sign next to it.
For more information,