Skip to main content

Module ga_binary

Module ga_binary 

Source
Expand description

Binary-coded Genetic Algorithm.

Operates on a Tensor<B, 2, Int> population where each gene is restricted to {0, 1}. Selection and elitism reuse the host-side fitness indexing helpers shared with the real-coded GA; crossover and mutation use the binary-specific operators in crate::ops::crossover::binary_uniform_crossover and crate::ops::mutation::bit_flip_mutation.

Fitness is treated as cost (lower is better) to match the rest of the strategies in this crate; benchmarks like OneMax must be phrased as minimization (D − count_ones) before being plugged in.

Structs§

BinaryGaConfig
Static configuration for a BinaryGeneticAlgorithm run.
BinaryGaState
State for BinaryGeneticAlgorithm.
BinaryGeneticAlgorithm
Binary-coded canonical Genetic Algorithm.