Algorithms¶
Complete Algorithms¶
These are complete boxed algorithms that are somewhat limited to the very
basic evolutionary computation concepts. All algorithms accept, in addition to
their arguments, an initialized Statistics
object to
maintain stats of the evolution, an initialized
HallOfFame
to hold the best individual(s) to appear in
the population, and a boolean verbose to specify wether to
log what is happening during the evolution or not.
Variations¶
Variations are smaller parts of the algorithms that can be used separately to build more complex algorithms.
Covariance Matrix Adaptation Evolution Strategy¶
A module that provides support for the Covariance Matrix Adaptation Evolution Strategy.
-
class
deap.cma.
Strategy
(centroid, sigma[, **kargs])¶ A strategy that will keep track of the basic parameters of the CMA-ES algorithm.
Parameters: - centroid – An iterable object that indicates where to start the evolution.
- sigma – The initial standard deviation of the distribution.
- parameter – One or more parameter to pass to the strategy as described in the following table, optional.
Parameter Default Details lambda_
int(4 + 3 * log(N))
Number of children to produce at each generation, N
is the individual’s size (integer).mu
int(lambda_ / 2)
The number of parents to keep from the lambda children (integer). cmatrix
identity(N)
The initial covariance matrix of the distribution that will be sampled. weights
"superlinear"
Decrease speed, can be "superlinear"
,"linear"
or"equal"
.cs
(mueff + 2) / (N + mueff + 3)
Cumulation constant for step-size. damps
1 + 2 * max(0, sqrt(( mueff - 1) / (N + 1)) - 1) + cs
Damping for step-size. ccum
4 / (N + 4)
Cumulation constant for covariance matrix. ccov1
2 / ((N + 1.3)^2 + mueff)
Learning rate for rank-one update. ccovmu
2 * (mueff - 2 + 1 / mueff) / ((N + 2)^2 + mueff)
Learning rate for rank-mu update. -
computeParams
(params)¶ Computes the parameters depending on
. It needs to be called again if
changes during evolution.
Parameters: params – A dictionary of the manually set parameters.
-
generate
(ind_init)¶ Generate a population of
individuals of type ind_init from the current strategy.
Parameters: ind_init – A function object that is able to initialize an individual from a list. Returns: A list of individuals.
-
update
(population)¶ Update the current covariance matrix strategy from the population.
Parameters: population – A list of individuals from which to update the parameters.
-
class
deap.cma.
StrategyOnePlusLambda
(parent, sigma[, **kargs])¶ A CMA-ES strategy that uses the
paradigme.
Parameters: - parent – An iterable object that indicates where to start the evolution. The parent requires a fitness attribute.
- sigma – The initial standard deviation of the distribution.
- parameter – One or more parameter to pass to the strategy as described in the following table, optional.
-
computeParams
(params)¶ Computes the parameters depending on
. It needs to be called again if
changes during evolution.
Parameters: params – A dictionary of the manually set parameters.
-
generate
(ind_init)¶ Generate a population of
individuals of type ind_init from the current strategy.
Parameters: ind_init – A function object that is able to initialize an individual from a list. Returns: A list of individuals.
-
update
(population)¶ Update the current covariance matrix strategy from the population.
Parameters: population – A list of individuals from which to update the parameters.