sannbox {pomp} | R Documentation |
Simulated annealing with box constraints.
Description
A straightforward implementation of simulated annealing with box constraints.
Usage
sannbox(par, fn, control = list(), ...)
Arguments
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. |
Details
The control
argument is a list that can supply any of the following components:
- trace
Non-negative integer. If positive, tracing information on the progress of the optimization is produced. Higher values may produce more tracing information.
- fnscale
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 onfn(par)/fnscale
.- parscale
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.- maxit
The total number of function evaluations: there is no other stopping criterion. Defaults to
10000
.- temp
starting temperature for the cooling schedule. Defaults to
1
.- tmax
number of function evaluations at each temperature. Defaults to
10
.- candidate.dist
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
isfunction(par,temp,scale) rnorm(n=length(par),mean=par,sd=scale*temp).
- sched
cooling schedule. A function of a three arguments giving the temperature as a function of iteration number and the control parameters
temp
andtmax
. By default,sched
isfunction(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
.- lower,upper
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
andupper=Inf
, i.e., there are no constraints.
Value
sannbox
returns a list with components:
- counts
-
two-element integer vector. The first number gives the number of calls made to
fn
. The second number is provided for compatibility withoptim
and will always be NA. - convergence
-
provided for compatibility with
optim
; will always be 0. - final.params
last tried value of
par
.- final.value
value of
fn
corresponding tofinal.params
.- par
best tried value of
par
.- value
value of
fn
corresponding topar
.
Author(s)
Daniel Reuman, Aaron A. King
See Also
trajectory matching, probe matching, spectrum matching, nonlinear forecasting.