sannbox
is a straightforward implementation of simulated annealing with box constraints.
sannbox(par, fn, control = list(), ...)
sannbox
returns a list with components:
fn
.
The second number is provided for compatibility with optim
and will always be NA.
optim
; will always be 0.par
.fn
corresponding to final.params
.par
.fn
corresponding to par
.control
argument is a list that can supply any of the following components:
trace
fnscale
fn
during optimization.
If negative, turns the problem into a maximization problem.
Optimization is performed on fn(par)/fnscale
.
parscale
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
10000
.
temp
1
.
tmax
10
.
candidate.dist
candidate.dist
is function(par,temp,scale) rnorm(n=length(par),mean=par,sd=scale*temp).
sched
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
.
lower
, upper
par
.
By default, lower=-Inf
and upper=Inf
, i.e., there are no constraints.
traj.match
, probe.match
.