selection_utils (macula_tweann v0.11.3)
View SourceSelection utilities for evolutionary algorithms.
Provides selection mechanisms used throughout the evolution process: - Roulette wheel selection (fitness-proportionate) - Random uniform selection - Weighted selection
Summary
Functions
Uniformly select a random element from a list.
Roulette wheel selection based on weights.
Select element with custom weight function.
Functions
Uniformly select a random element from a list.
Each element has equal probability of selection.
Roulette wheel selection based on weights.
Selects an element with probability proportional to its weight. Higher weight = higher probability of selection.
Algorithm: 1. Calculate total weight 2. Generate random value in [0, total) 3. Accumulate weights until random value exceeded
Select element with custom weight function.
Applies a weight function to each element, then performs roulette wheel selection.