SCEoptim: Shuffled Complex Evolution (SCE) optimisation.

View source: R/SCEoptim.R

SCEoptimR Documentation

Shuffled Complex Evolution (SCE) optimisation.

Description

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/)

Usage

SCEoptim(FUN, par, lower = -Inf, upper = Inf, control = list(), ...)

Arguments

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 par and as upper, or length 1 if a bound applies to all parameters.

upper

upper bounds on the parameters. Should be the same length as par and as lower, or length 1 if a bound applies to all parameters.

control

a list of options as in optim(), see Details.

...

further arguments passed to FUN

Details

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

reltol is the convergence threshold: relative improvement factor required in an SCE iteration (in same sense as optim), and defaults to 1e-5.

tolsteps

tolsteps is the number of iterations where the improvement is within reltol required to confirm convergence. This defaults to 20.

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.

Value

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$returnpop = TRUE), the parameter sets from each iteration are returned in a three dimensional array.

control

the list of options settings in effect.

Author(s)

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:

References

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.

See Also

optim, DEoptim package, rgenoud package

Examples


## 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


SoilHyP documentation built on Feb. 16, 2023, 7:06 p.m.

Related to SCEoptim in SoilHyP...