Expand description
Mate selection methods for evolutionary algorithms
This crate provides several strategies for selecting individuals from a population to serve as parents in an evolutionary algorithm. Each individual is represented by a reproductive fitness score, and a selection method determines the probability with which individuals are selected.
Selection methods range from uniform random selection to methods that strongly favor individuals with high fitness. Both score-based and rank-based methods are provided, allowing selection pressure to be based either on the magnitude of fitness scores or only on their relative ordering.
The crate also provides parse, which converts a specification string into a selection method. This is useful for applications that expose mate selection as a command-line option or configuration value.
Selection methods are stochastic: selecting the same population repeatedly will always produce different results. Currently, this crate does not support custom random number generators or seeds.
§Example
use mate_selection::{MateSelection, Proportional};
let selector = Proportional();
let scores = vec![1.0, 2.0, 3.0, 4.0];
let probabilities = selector.pdf(scores.clone()).unwrap();
println!("{probabilities:?}");
let parents = selector.select(10, scores.clone()).unwrap();
println!("{parents:?}");
let pairs = selector.pairs(5, scores).unwrap();
println!("{pairs:?}");Structs§
- Argument
Error - Best
- Select parents from the best ranked individuals in the population. Among the top scoring individuals, individuals are sampled with uniform random probability.
- Normalized
- Sigma Scaling — Normalize the fitness scores into a standard normal distribution. First the scores are normalized into a standard distribution and then they are shifted by the cutoff, which is naturally measured in standard deviations. All scores which are less than the cutoff (now sub-zero) are discarded and those individuals are not permitted to mate. Finally the scores are divided by their sum to yield a selection probability. This method improves upon the proportional method by controlling for the magnitude and variation of the fitness scoring function.
- Percentile
- Apply a simple percentile based threshold to the population. Mating pairs are selected with uniform random probability from the eligible members of the population.
- Proportional
- Select parents with a probability that is directly proportional to their score.
- Random
- Select parents with a uniform random probability, ignoring the scores.
- Ranked
Exponential - Select parents based on their ranking in the population, with an exponentially weighted bias towards better ranked individuals. This method can apply more selection pressure than the RankedLinear method can, which is useful when dealing with very large populations or with a very large number of offspring.
- Ranked
Linear - Select parents based on their ranking in the population. This method sorts the individuals by their scores in order to rank them from worst to best. The sampling probability is a linear function of the rank.
Traits§
- Mate
Selection - A mate selection strategy for an evolutionary algorithm.
Functions§
- parse
- Parse a specification string into a mate selection object.