| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| R2010b Documentation → Global Optimization Toolbox |
| Contents | Index |
| Learn more about Global Optimization Toolbox |
| On this page… |
|---|
This section presents an example that shows how to find the minimum of the function using simulated annealing.
De Jong's fifth function is a two-dimensional function with many (25) local minima:
dejong5fcn

Many standard optimization algorithms get stuck in local minima. Because the simulated annealing algorithm performs a wide random search, the chance of being trapped in local minima is decreased.
Note Because simulated annealing uses random number generators, each time you run this algorithm you can get different results. See Reproducing Your Results for more information. |
To run the simulated annealing algorithm without constraints, call simulannealbnd at the command line using the objective function in dejong5fcn.m, referenced by anonymous function pointer:
fun = @dejong5fcn; [x fval] = simulannealbnd(fun, [0 0])
This returns
x =
-31.9779 -31.9595
fval =
0.9980
where
x is the final point returned by the algorithm.
fval is the objective function value at the final point.
To run the minimization using the Optimization Tool,
Set up your problem as pictured in the Optimization Tool

Click Start under Run solver and view results:

![]() | Performing a Simulated Annealing Optimization | Understanding Simulated Annealing Terminology | ![]() |

Learn how to use optimization to solve systems of equations, fit models to data, or optimize system performance.
Get free kit| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |