ExtremalOptimization
for functions of continuous variables.
This package implements the basic mechanism of Extremal Optimization (τ-EO) as described in Boettcher, Stefan; Percus, Allon G. (2001-06-04). "Optimization with Extremal Dynamics". Physical Review Letters.
The only twist w.r.t. classical EO is an affine invariant update equation for the worst performing solutions,
where X₁, X₂, X₃ are chosen random inside the pool of candidate solutions, this update mechanism allows EO to work on continuous spaces, and be invariant w.r.t. affine transformations of X and monotonous tranformations of the cost function.
API:
function optimize(
f,
s,
N;
reps_per_particle = 100,
β = 1.5,
A = 1.0,
atol = 0.0,
rtol = sqrt(eps(1.0)),
f_atol = 0.0,
f_rtol = sqrt(eps(1.0)),
verbose = false,
rng = Random.GLOBAL_RNG,
callback = state -> nothing,
)
f
: cost function to minimize, whose argument is either a scalar or a vector, must returns a scalar value.s
: function whose input is the particle number and output is a random initial point to be ranked byf
.N
: number of particles to use, choose a number greater thand+4
whered
is the number of dimensions.reps_per_particle
: maximum number of iterations per particle.
Usage example:
using ExtremalOptimization
rosenbrock2d(x) = (x[1] - 1)^2 + 100*(x[2] - x[1]^2)^2
initpoint(i) = randn(2)
optimize(rosenbrock2d, initpoint, 20)
output
(x = [1.0000008, 1.0000016], fx = 6.50e-13, f_nevals = 1109)
as expected the algorithm has found the optimum at (1, 1)
, up to the specified tolerance.