SCEoptim {hydromad} | R Documentation |
Shuffled Complex Evolution (SCE) optimisation.
Designed to have a similar interface to the standard
optim
function.
SCEoptim(FUN, par, ..., lower = -Inf, upper = Inf, control = list())
FUN |
function to optimise (to minimise by default), or the name of one. This should return a scalar numeric value. |
par |
a numeric vector of initial parameter values. |
... |
further arguments passed to |
lower, upper |
lower and upper bounds on the parameters.
Should be the same length as |
control |
a list of options as in |
This is an evolutionary algorithm combined with a simplex algorithm.
Options can be given in the list control
, in the same way as
with optim
:
ncomplex
number of complexes. Defaults to 5
.
cce.iter
number of iteration in inner loop (CCE algorithm).
Defaults to NA
, in which case it is taken as
2 * NDIM + 1
, as recommended by Duan et al (1994).
fnscale
function scaling factor (set to -1 for a maximisation problem). By default it is a minimisation problem.
elitism
influences sampling of parents from each complex. Duan et al
(1992) describe a 'trapezoidal' (i.e. linear weighting) scheme,
which corresponds to elitism = 1
.
Higher values give more weight towards the better parameter sets.
Defaults to 1
.
initsample
sampling scheme for initial values: "latin" (hypercube) or "random".
Defaults to "latin"
.
reltol
, tolsteps
reltol
is the convergence threshold: relative improvement
factor required in an SCE iteration (in same sense as
optim
), and defaults to 1e-5
.
tolsteps
is the number of iterations where the improvement
is within reltol
required to confirm convergence. This
defaults to 7
.
maxit
maximum number of iterations. Defaults to 10000
.
maxeval
maximum number of function evaluations. Defaults to Inf
.
maxtime
maximum duration of optimization in seconds. Defaults to Inf
.
returnpop
whether to return populations (parameter sets) from all
iterations. Defaults to FALSE
.
trace
an integer specifying the level of user feedback. Defaults to 0
.
REPORT
number of iterations between reports when trace >= 1. Defaults to 1
.
a list of class "SCEoptim"
.
par |
optimal parameter set. |
value |
value of objective function at optimal point. |
convergence |
code, where 0 indicates successful covergence. |
message |
(non-)convergence message. |
counts |
number of function evaluations. |
iterations |
number of iterations of the CCE algorithm. |
time |
number of seconds taken. |
POP.FIT.ALL |
objective function values from each iteration in a matrix. |
BESTMEM.ALL |
best parameter set from each iteration in a matrix. |
POP.ALL |
if |
control |
the list of options settings in effect. |
Felix Andrews felix@nfrac.org
This was adapted, and substantially revised, from Brecht Donckels' MATLAB code, which was in turn adapted from Qingyun Duan's MATLAB code:
http://biomath.ugent.be/~brecht/downloads.html
Qingyun Duan, Soroosh Sorooshian and Vijai Gupta (1992). Effective and Efficient Global Optimization for Conceptual Rainfall-Runoff Models, Water Resources Research 28(4), pp. 1015-1031.
Qingyun Duan, Soroosh Sorooshian and Vijai Gupta (1994). Optimal use of the SCE-UA global optimization method for calibrating watershed models, Journal of Hydrology 158, pp. 265-284.
optim
, DEoptim package, rgenoud package
## reproduced from help("optim") ## Rosenbrock Banana function Rosenbrock <- function(x){ x1 <- x[1] x2 <- x[2] 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } #lower <- c(-10,-10) #upper <- -lower ans <- SCEoptim(Rosenbrock, c(-1.2,1), control = list(trace = 1)) str(ans) ## 'Wild' function, global minimum at about -15.81515 Wild <- function(x) 10*sin(0.3*x)*sin(1.3*x^2) + 0.00001*x^4 + 0.2*x+80 ans <- SCEoptim(Wild, 0, lower = -50, upper = 50, control = list(trace = 1)) ans$par