Selection operators
Parent and Survivor selection operators (a.k.a. selectors) in EvoLP are based on fitness and are used to select individuals for crossover or survival for the next generation. The selectors always return indices so that individuals can be selected from the population later.
Parent Selectors
Parent selectors are used to generate the mating pool (the offspring) in evolutionary algorithms. Since EvoLP.jl v2.1, all parent selectors can now optionally take a sample size N to generate an entire mating pool in a single function call. If N is omitted, they default to 2, as in a steady-state genetic algorithm where 2 parents create 1 offspring.
For generational algorithms, you need to pass the appropriate value for $N$, for example, once per each individual in the population, or $N=\mu$.
Parent selectors are derived from the EvoLP.ParentSelector abstract type, which is itself derived from the EvoLP.Selector abstract super type. Some of the selectors have parameters you can adjust.
EvoLP.TournamentSelector — Type
Tournament parent selection with tournament size T.
EvoLP.TruncationSelector — Type
Truncation selection for selecting top k possible parents in the population.
EvoLP.RouletteWheelSelector — Type
Roulette wheel parent selection.
EvoLP.RankBasedSelector — Type
Rank-based parent selection.
EvoLP.UniformSelector — Type
Uniform parent selection for ES and EAs.
Survival Selectors
Survival selectors are deterministic operators that choose which individuals survive to form the next generation. They are commonly used in Evolutionary Strategies and Evolutionary Algorithms with no crossover (mutation only).
Survival selectors are derived from the EvoLP.SurvivalSelector, and as parent selectors, they also return indices that can be applied directly to your population arrays.
For PlusSelector, the returned indices refer to a concatenated array of vcat(parents, offspring).
Unlike Parent Selectors, which rely on stochastic sampling to generate a mating pool, Survival Selectors in EvoLP model strict environmental truncation. Their select methods do not accept or require a Random Number Generator (rng) parameter because they deterministically extract the top μ individuals.
EvoLP.CommaSelector — Type
CommaSelector(μ::Int)$(\mu, \lambda)$ survival selection. Selects the indices of the best μ individuals exclusively from the offspring population.
EvoLP.PlusSelector — Type
PlusSelector(μ::Int)$(\mu + \lambda)$ survival selection. Selects the indices of the best μ individuals from the combined pool of parents and offspring.
Performing the selection
After "instantiating" a selection method, you can use the select function on an array of fitnesses y to obtain $N$ parent indices (that you will need to slice from the population in your algorithm later.)
In the case of survival selectors, you would get $N$ indices (that you will need to slice from the population of offspring, for example) to get the population for the next iteration.
EvoLP.select — Function
select(t::TournamentSelector, y, N::Int = 2; rng = Random.GLOBAL_RNG)Select N parents which are the winners from N random tournaments of size t.T.
select(t::TruncationSelector, y, N::Int = 2; rng = Random.GLOBAL_RNG)Select N random parent indices out from the top t.k in the population.
select(::RouletteWheelSelector, y, N::Int = 2; rng = Random.GLOBAL_RNG)Select N random parent indices with probability proportional to their fitness.
select(::RankBasedSelector, y, N::Int = 2; rng = Random.GLOBAL_RNG)Select N random parent indices with probability proportional to their ranks.
select(::UniformSelector, y, N::Int = 2; rng = Random.GLOBAL_RNG)Select N parent indices uniformly at random with replacement. Useful for (μ, λ)-ES and EAs.
select(S::CommaSelector, y_λ)Return the indices of the best μ offspring.
select(S::PlusSelector, y_μ, y_λ)Return the indices of the best μ individuals from both parents and offspring.
select(S_M::RandomDemeSelector, y)Return a list of size S_M.k of random indices from a vector of fitnesses y. Used inside drift to select individuals to be sent to another island, or inside reinsert! to select individuals to be replaced.
select(S_M::WorstDemeSelector, y)Return the indices of the S_M.k-worst fitnesses in y. Used inside drift to select individuals to be sent to another island, or inside reinsert! to select individuals to be replaced.