Minimize a function with SCE-UA

Description

Find the parameter set that minimizes an objective function using the Shuffled Complex Evolution - University of Arizona (SCE-UA) algorithm (Duan et al., 1992).

Usage

sceua(
  fn,
  lower,
  upper,
  initial = NULL,
  max_evaluations = 10000L,
  kstop = 5L,
  pcento = 0.01,
  complexes = 2L,
  points_per_complex = NULL,
  simplex_size = NULL,
  evolution_steps = NULL,
  min_complexes = NULL,
  parameter_epsilon = 0.001,
  ...
)

Arguments

fn Function to minimize. Must accept a single numeric vector of parameters and return a scalar numeric value.
lower Numeric vector of lower bounds. Must have the same length as upper.
upper Numeric vector of upper bounds. Must have the same length as lower.
initial Optional initial parameter vector. If provided, it is included in the initial population.
max_evaluations Maximum number of function evaluations.
kstop Number of shuffling loops over which the objective value must change by pcento before convergence.
pcento Objective convergence threshold.
complexes Number of complexes in the initial population.
points_per_complex Number of points in each complex. Defaults to 2 * n + 1 where n is the number of parameters.
simplex_size Number of points in each sub-complex. Defaults to n + 1.
evolution_steps Number of evolution steps allowed for each complex before shuffling. Defaults to points_per_complex.
min_complexes Minimum number of complexes required. Defaults to complexes.
parameter_epsilon Parameter convergence threshold.
Additional arguments passed to fn.

Details

The R wrapper draws the internal SCE-UA seed from R’s global random number generator. Call set.seed() before sceua() for reproducible results.

Value

An object of class sceua: a list with components:

  • par: best parameter vector.

  • value: objective value at par.

  • counts: number of function evaluations.

  • iterations: number of shuffling loops.

  • termination: reason for termination.

  • history: a data.frame with one row per shuffling loop.

References

Duan, Q., Sorooshian, S., and Gupta, V.K., 1992. Effective and efficient global optimization for conceptual rainfall-runoff models. Water Resour. Res. 28 (4), 1015-1031.

Examples

library("sceua")

set.seed(1234)
# Two-dimensional sphere
result <- sceua(
  fn = function(x) sum(x^2),
  lower = c(-5, -5),
  upper = c(5, 5),
  max_evaluations = 5000,
  kstop = 5,
  pcento = 1e-8,
  complexes = 5
)
result
<sceua>
best value:    1.28387e-11
evaluations:   778
iterations:    19
termination:   parameter_convergence
best parameters:
[1] 2.844955e-06 2.178275e-06