Title: | Covariance Matrix Adapting Evolutionary Strategy |
---|---|
Description: | Single objective optimization using a CMA-ES. |
Authors: | Heike Trautmann <[email protected]> and Olaf Mersmann <[email protected]> and David Arnu <[email protected]> |
Maintainer: | Olaf Mersmann <[email protected]> |
License: | GPL-2 |
Version: | 1.0-12 |
Built: | 2024-12-23 06:39:21 UTC |
Source: | CRAN |
Create a biased test function
bias_function(f, bias)
bias_function(f, bias)
f |
test function |
bias |
bias value. |
Returns a new biased test function defined as
The biased test function.
Olaf Mersmann [email protected]
Global optimization procedure using a covariance matrix adapting evolutionary strategy.
cma_es(par, fn, ..., lower, upper, control=list()) cmaES(...)
cma_es(par, fn, ..., lower, upper, control=list()) cmaES(...)
par |
Initial values for the parameters to be optimized over. |
fn |
A function to be minimized (or maximized), with first argument the vector of parameters over which minimization is to take place. It should return a scalar result. |
... |
Further arguments to be passed to |
lower |
Lower bounds on the variables. |
upper |
Upper bounds on the variables. |
control |
A list of control parameters. See ‘Details’. |
cma_es
: Note that arguments after ...
must be matched exactly.
By default this function performs minimization, but it will
maximize if control$fnscale
is negative. It can usually be
used as a drop in replacement for optim
, but do note, that
no sophisticated convergence detection is included. Therefore you
need to choose maxit
appropriately.
If you set vectorize==TRUE
, fn
will be passed matrix
arguments during optimization. The columns correspond to the
lambda
new individuals created in each iteration of the
ES. In this case fn
must return a numeric vector of
lambda
corresponding function values. This enables you to
do up to lambda
function evaluations in parallel.
The control
argument is a list that can supply any of the
following components:
fnscale
An overall scaling to be applied to the value
of fn
during optimization. If negative,
turns the problem into a maximization problem. Optimization is
performed on fn(par)/fnscale
.
maxit
The maximum number of iterations. Defaults to
, where
is the dimension of the parameter space.
stopfitness
Stop if function value is smaller than or
equal to stopfitness
. This is the only way for the CMA-ES
to “converge”.
return the best overall solution and not the best solution in the last population. Defaults to true.
sigma
Initial variance estimates. Can be a single
number or a vector of length , where
is the dimension
of the parameter space.
mu
Population size.
lambda
Number of offspring. Must be greater than or
equal to mu
.
weights
Recombination weights
damps
Damping for step-size
cs
Cumulation constant for step-size
ccum
Cumulation constant for covariance matrix
vectorized
Is the function fn
vectorized?
ccov.1
Learning rate for rank-one update
ccov.mu
Learning rate for rank-mu update
diag.sigma
Save current step size
in each iteration.
diag.eigen
Save current principle components
of the covariance matrix in each iteration.
diag.pop
Save current population in each iteration.
diag.value
Save function values of the current population in each iteration.
cma_es
: A list with components:
The best set of parameters found.
The value of fn
corresponding to par
.
A two-element integer vector giving the number of calls
to fn
. The second element is always zero for call
compatibility with optim
.
An integer code. 0
indicates successful
convergence. Possible error codes are
1
indicates that the iteration limit maxit
had been reached.
Always set to NULL
, provided for call
compatibility with optim
.
List containing diagnostic information. Possible elements are:
Vector containing the step size
for each iteration.
matrix containing the
principle components of the covariance matrix
.
An array
containing all populations. The last dimension is the iteration
and the second dimension the individual.
A matrix
containing the function values of each population. The first
dimension is the iteration, the second one the individual.
These are only present if the respective diagnostic control variable is
set to TRUE
.
Olaf Mersmann [email protected] and David Arnu [email protected]
Hansen, N. (2006). The CMA Evolution Strategy: A Comparing Review. In J.A. Lozano, P. Larranga, I. Inza and E. Bengoetxea (eds.). Towards a new evolutionary computation. Advances in estimation of distribution algorithms. pp. 75-102, Springer
Extract the iter
-th population
extract_population(res, iter)
extract_population(res, iter)
res |
A |
iter |
Which population to return. |
Return the population of the iter
-th iteration of the
CMA-ES algorithm. For this to work, the populations must be saved
in the result object. This is achieved by setting
diag.pop=TRUE
in the control
list. Function values
are included in the result if present in the result object.
A list containing the population as the par
element
and possibly the function values in value
if they are
present in the result object.
Random function
f_rand(x)
f_rand(x)
x |
parameter vector. |
Olaf Mersmann [email protected]
Rastrigin function
f_rastrigin(x)
f_rastrigin(x)
x |
parameter vector. |
David Arnu [email protected]
Rosenbrock function
f_rosenbrock(x)
f_rosenbrock(x)
x |
parameter vector. |
David Arnu [email protected]
Sphere function
f_sphere(x)
f_sphere(x)
x |
parameter vector. |
Create a rotated test function
rotate_function(f, M)
rotate_function(f, M)
f |
test function. |
M |
orthogonal square matrix defining the rotation. |
Returns a new rotated test function defined as
The rotated test function.
Olaf Mersmann [email protected]
Returns a new function
shift_function(f, offset)
shift_function(f, offset)
f |
test function |
offset |
offset. |
The shifted test function.
Olaf Mersmann [email protected]