Bardo.PopulationManager.SelectionAlgorithm (Bardo v0.1.0)
View SourceThe SelectionAlgorithm module provides different strategies for selecting agents for reproduction.
Overview
Selection algorithms determine which agents in a population survive and reproduce. These algorithms form the backbone of the evolutionary process by implementing the principle of "survival of the fittest."
Selection Strategies
Bardo implements several selection strategies, each with different characteristics:
Hall of Fame Competition
- Maintains an elite subset of the best-performing agents across generations
- New agents must compete against the hall of fame to be selected
- Provides protection against evolutionary forgetting and cycling
Tournament Selection
- Randomly selects subgroups of agents and chooses the best from each group
- Selection pressure can be tuned by adjusting tournament size
- Balances exploration and exploitation effectively
Truncation Selection
- Simply selects the top N performers from the population
- Provides high selection pressure for rapid convergence
- May lead to premature convergence on suboptimal solutions
Rank-Based Selection
- Selection probability is based on rank rather than absolute fitness
- Maintains selection pressure even when fitness differences are small
- Helps prevent premature convergence in some scenarios
Fitness Proportionate Selection
- Also known as "roulette wheel" selection
- Selection probability is directly proportional to fitness
- Simple but can lead to early domination by slightly superior agents
Implementation Notes
- Selection algorithms operate within species to preserve diversity
- Parameters can adjust selection pressure to balance exploration vs. exploitation
- Custom selection algorithms can be implemented by adding new functions to this module
Summary
Functions
Choose winners for the next generation based on fitness scores.
Implementation of the 'hof_competition' selection algorithm.
Implementation of the 'hof_efficiency' selection algorithm.
Implementation of the 'hof_random' selection algorithm.
Implementation of the 'hof_rank' selection algorithm.
Implementation of the 'hof_top3' selection algorithm.
Functions
@spec choose_winners( Bardo.Models.specie_id(), [Bardo.Models.agent_id()], float(), [Bardo.Models.agent_id()], [Bardo.Models.agent_id()], non_neg_integer() ) :: [Bardo.Models.agent_id()]
Choose winners for the next generation based on fitness scores.
@spec hof_competition(Bardo.Models.specie_id(), [map()], non_neg_integer()) :: :ok
Implementation of the 'hof_competition' selection algorithm.
@spec hof_efficiency( Bardo.Models.specie_id(), [Bardo.Models.agent_id()], non_neg_integer() ) :: :ok
Implementation of the 'hof_efficiency' selection algorithm.
@spec hof_random( Bardo.Models.specie_id(), [Bardo.Models.agent_id()], non_neg_integer() ) :: :ok
Implementation of the 'hof_random' selection algorithm.
@spec hof_rank(Bardo.Models.specie_id(), [Bardo.Models.agent_id()], non_neg_integer()) :: :ok
Implementation of the 'hof_rank' selection algorithm.
@spec hof_top3(Bardo.Models.specie_id(), [Bardo.Models.agent_id()], non_neg_integer()) :: :ok
Implementation of the 'hof_top3' selection algorithm.