Expand description
Binary-coded Genetic Algorithm.
A canonical GA over Tensor<B, 2, Int> populations where every gene is
restricted to {0, 1}:
- Evaluate the current population (done externally by the harness).
- Select two independent sets of parents via
crate::ops::selection::tournament_indices_host(k-tournament). - Recombine via
crate::ops::crossover::binary_uniform_crossover(per-gene coin flip with probabilitycrossover_p). - Mutate via
crate::ops::mutation::bit_flip_mutation(per-gene flip with probabilitymutation_rate). - Replace via fixed elitist policy: the
elitism_kbest parents survive; the remainingpop_size − elitism_kslots are filled by the best offspring.
Unlike crate::algorithms::ga::GeneticAlgorithm, there is no
enum-selectable replacement policy — only elitist replacement is
supported. Extend BinaryGaConfig and the tell impl if a
generational variant is needed.
All random draws go through crate::rng::seed_stream — never
B::seed + Tensor::random — so per-run results are reproducible
across thread schedules.
§Fitness convention
Fitness is treated as cost (lower is better), matching all other
strategies in this crate. Maximization benchmarks like OneMax must be
phrased as minimization before being plugged in, e.g.:
cost = D − count_ones(genome).
§References
- Holland (1975), Adaptation in Natural and Artificial Systems.
- Goldberg (1989), Genetic Algorithms in Search, Optimization, and Machine Learning.
Structs§
- Binary
GaConfig - Static configuration for a
BinaryGeneticAlgorithmrun. - Binary
GaState - State for
BinaryGeneticAlgorithm. - Binary
Genetic Algorithm - Binary-coded canonical Genetic Algorithm.