modea.Selection module¶
This module contains a collection of Selection operators.
Selection accepts (mu + lambda) individuals and returns (mu) individuals that are chosen to be the best of this generation according to which selection module is chosen.
-
modea.Selection.
best
(population, new_population, param)¶ Given the population, return the (mu) best. Also performs some ‘housekeeping’ for the CMA-ES by collecting all genotypes and most recent mutation vectors and storing them in the
param
object.Parameters: - population – List of
FloatIndividual
objects containing the previous generation - new_population – List of
FloatIndividual
objects containing the new generation - param –
Parameters
object for storing all parameters, options, etc.
Returns: A slice of the sorted new_population list.
- population – List of
-
modea.Selection.
bestGA
(population, new_population, param)¶ Given the population, return the (mu) best
Parameters: - population – List of
MixedIntIndividual
objects containing the previous generation - new_population – List of
MixedIntIndividual
objects containing the new generation - param –
Parameters
object for storing all parameters, options, etc.
Returns: A slice of the sorted new_population list.
- population – List of
-
modea.Selection.
onePlusOneSelection
(population, new_population, t, param)¶ (1+1)-selection (with success history)
Parameters: - population – List of
FloatIndividual
objects containing the previous generation - new_population – List of
FloatIndividual
objects containing the new generation - t – Timestamp of the current generation being evaluated
- param –
Parameters
object for storing all parameters, options, etc.
Returns: A slice of the sorted new_population list.
- population – List of
-
modea.Selection.
pairwise
(population, new_population, param)¶ Perform a selection on individuals in a population per pair, before letting
best()
make the final selection. Intended for use with aMirroredSampling
sampler to prevent step-size bias.Assumes that new_population contains pairs as [P1_a, P1_b, P2_a, P2_b, etc … ]
Parameters: - population – List of
FloatIndividual
objects containing the previous generation - new_population – List of
FloatIndividual
objects containing the new generation - param –
Parameters
object for storing all parameters, options, etc.
Returns: A slice of the sorted new_population list.
- population – List of
-
modea.Selection.
roulette
(population, new_population, param, force_unique=False)¶ Given the population, return mu individuals, selected by roulette, using 1/fitness as probability
Parameters: - population – List of
FloatIndividual
objects containing the previous generation - new_population – List of
FloatIndividual
objects containing the new generation - param –
Parameters
object for storing all parameters, options, etc. - force_unique – Determine if an individual from the original population may be selected multiple times
Returns: A slice of the sorted new_population list.
- population – List of