SCEoptim | R Documentation |
Shuffled Complex Evolution (SCE) optimisation. Designed to have a similar interface to the standard optim
function.
The function is copied from the hydromad package (https://github.com/floybix/hydromad/)
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. |
lower |
lower bounds on the parameters. Should be the same length as |
upper |
upper bounds on the parameters. Should be the same length as |
control |
a list of options as in |
... |
further arguments passed to |
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
:
number of complexes. Defaults to
5
.
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).
function scaling factor (set to -1 for a maximisation problem). By default it is a minimisation problem.
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
.
sampling scheme for initial
values: "latin" (hypercube) or "random". Defaults to "latin"
.
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 20
.
maximum number of iterations. Defaults to
10000
.
maximum number of function
evaluations. Defaults to Inf
.
maximum
duration of optimization in seconds. Defaults to Inf
.
whether to return populations (parameter sets)
from all iterations. Defaults to FALSE
.
an
integer specifying the level of user feedback. Defaults to 0
.
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. |
This code is copied from the hydromad package
https://github.com/floybix/hydromad/
http://hydromad.catchment.org/
and written from Felix Andrews felix@nfrac.org
who adapted, and substantially revised it, from Brecht Donckels' MATLAB code,
which was in turn adapted from Qingyun Duan's MATLAB code:
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.