sannbox | R Documentation |
A straightforward implementation of simulated annealing with box constraints.
sannbox(par, fn, control = list(), ...)
par |
Initial values for the parameters to be optimized over. |
fn |
A function to be minimized, with first argument the vector of parameters over which minimization is to take place. It should return a scalar result. |
control |
A named list of control parameters. See ‘Details’. |
... |
ignored. |
The control
argument is a list that can supply any of the following components:
Non-negative integer. If positive, tracing information on the progress of the optimization is produced. Higher values may produce more tracing information.
An overall scaling to be applied to the value of
fn
during optimization. If negative, turns the problem into a
maximization problem. Optimization is performed on fn(par)/fnscale
.
A vector of scaling values for the parameters.
Optimization is performed on par/parscale
and these should be
comparable in the sense that a unit change in any element produces about a
unit change in the scaled value.
The total number of function evaluations: there is no
other stopping criterion. Defaults to 10000
.
starting temperature for the cooling
schedule. Defaults to 1
.
number of function evaluations at each temperature.
Defaults to 10
.
function to randomly select a new candidate
parameter vector. This should be a function with three arguments, the
first being the current parameter vector, the second the temperature, and
the third the parameter scaling. By default, candidate.dist
is
function(par,temp,scale) rnorm(n=length(par),mean=par,sd=scale*temp).
cooling schedule. A function of a three arguments giving the
temperature as a function of iteration number and the control parameters
temp
and tmax
.
By default, sched
is
function(k,temp,tmax) temp/log(((k-1)%/%tmax)*tmax+exp(1)).
Alternatively, one can supply a numeric vector of temperatures.
This must be of length at least maxit
.
optional
numeric vectors. These describe the lower and upper box constraints,
respectively. Each can be specified either as a single scalar (common to
all parameters) or as a vector of the same length as par
. By
default, lower=-Inf
and upper=Inf
, i.e., there are no
constraints.
sannbox
returns a list with components:
two-element integer vector.
The first number gives the number of calls made to fn
.
The second number is provided for compatibility with optim
and will always be NA.
provided for compatibility with optim
;
will always be 0.
last tried value of par
.
value of fn
corresponding to
final.params
.
best tried value of par
.
value of fn
corresponding to par
.
Daniel Reuman, Aaron A. King
trajectory matching, probe matching, spectrum matching, nonlinear forecasting.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.