# SCEoptim

##### Shuffled Complex Evolution (SCE) optimisation.

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

- Keywords
- optimize

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

.

##### Value

a list of class `"SCEoptim"`

.

optimal parameter set.

value of objective function at optimal point.

code, where 0 indicates successful covergence.

(non-)convergence message.

number of function evaluations.

number of iterations of the CCE algorithm.

number of seconds taken.

objective function values from each iteration in a matrix.

best parameter set from each iteration in a matrix.

if `(control$returnpop = TRUE)`

, the parameter sets
from each iteration are returned in a three dimensional array.

the list of options settings in effect.

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

```
# NOT RUN {
## 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
# }
```

*Documentation reproduced from package SoilHyP, version 0.1.3, License: GPL (>= 2)*