simulannealbnd

Find unconstrained or bound-constrained minimum of function of several variables using simulated annealing algorithm

Syntax

x = simulannealbnd(fun,x0)
x = simulannealbnd(fun,x0,lb,ub)
x = simulannealbnd(fun,x0,lb,ub,options)
x = simulannealbnd(problem)
[x,fval] = simulannealbnd(...)
[x,fval,exitflag] = simulannealbnd(...)
[x,fval,exitflag,output] = simulannealbnd(fun,...)

Description

x = simulannealbnd(fun,x0) starts at x0 and finds a local minimum x to the objective function specified by the function handle fun. The objective function accepts input x and returns a scalar function value evaluated at x. x0 may be a scalar or a vector.

x = simulannealbnd(fun,x0,lb,ub) defines a set of lower and upper bounds on the design variables, x, so that a solution is found in the range lb x ub. Use empty matrices for lb and ub if no bounds exist. Set lb(i) to -Inf if x(i) is unbounded below; set ub(i) to Inf if x(i) is unbounded above.

x = simulannealbnd(fun,x0,lb,ub,options) minimizes with the default optimization parameters replaced by values in the structure options, which can be created using the saoptimset function. See the saoptimset reference page for details.

x = simulannealbnd(problem) finds the minimum for problem, where problem is a structure containing the following fields:

objective

Objective function

x0

Initial point of the search

lb

Lower bound on x

ub

Upper bound on x

randstate

Optional field to reset rand state

randnstate

Optional field to reset randn state

solver

'simulannealbnd'

options

Options structure created using saoptimset

Create the structure problem by exporting a problem from Optimization Tool, as described in Importing and Exporting Your Work in the Optimization Toolbox™ User's Guide.

[x,fval] = simulannealbnd(...) returns fval, the value of the objective function at x.

[x,fval,exitflag] = simulannealbnd(...) returns exitflag, an integer identifying the reason the algorithm terminated. The following lists the values of exitflag and the corresponding reasons the algorithm terminated:

[x,fval,exitflag,output] = simulannealbnd(fun,...) returns output, a structure that contains information about the problem and the performance of the algorithm. The output structure contains the following fields:

Examples

Minimization of De Jong's fifth function, a two-dimensional function with many local minima. Enter the command dejong5fcn to generate the following plot.

x0 = [0 0];
[x,fval] = simulannealbnd(@dejong5fcn,x0)

Optimization terminated: change in best function value
                         less than options.TolFun.

x =
    0.0392  -31.9700

fval =
    2.9821

Minimization of De Jong's fifth function subject to lower and upper bounds:

x0 = [0 0];
lb = [-64 -64];
ub = [64 64];
[x,fval] = simulannealbnd(@dejong5fcn,x0,lb,ub)

Optimization terminated: change in best function value
                         less than options.TolFun.

x =
  -31.9652  -32.0286

fval =
    0.9980

The objective can also be an anonymous function:

fun =  @(x) 3*sin(x(1))+exp(x(2));
x = simulannealbnd(fun,[1;1],[0 0])

Optimization terminated: change in best function value
                         less than options.TolFun.

x =
  457.1045
    0.0000

Minimization of De Jong's fifth function while displaying plots:

x0 = [0 0];
options = saoptimset('PlotFcns',{@saplotbestx,...
                @saplotbestf,@saplotx,@saplotf});
simulannealbnd(@dejong5fcn,x0,[],[],options)

Optimization terminated: change in best function value
                         less than options.TolFun.

ans =
    0.0230  -31.9806

The plots displayed are shown below.

See Also

ga, patternsearch, saoptimget, saoptimset, threshacceptbnd

  


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