Behaviour for selection strategies.
Selection determines which entities from the current population should be chosen as parents for the next generation.
Summary
Callbacks
Maintain diversity in the selected population.
Select entities from the population for reproduction.
Types
Callbacks
@callback maintain_diversity(population(), population(), opts()) :: population()
Maintain diversity in the selected population.
This optional callback can be implemented to ensure the selected population maintains genetic diversity.
@callback select(population(), scores(), count(), opts()) :: population()
Select entities from the population for reproduction.
Parameters
population- The current populationscores- Map of entity to fitness scorecount- Number of entities to selectopts- Strategy-specific options
Returns
A list of selected entities for reproduction.
Examples
def select(population, scores, count, opts) do
# Tournament selection implementation
Enum.take_random(population, count)
end