pub trait ReplacementStrategy<C: Chromosome>: Send + Sync {
// Required method
fn replace(
&self,
population: &Population<C>,
encoder: Arc<dyn Fn() -> Genotype<C> + Send + Sync>,
) -> Genotype<C>;
}
Expand description
Trait for replacement strategies in genetic algorithms.
This trait defines a method for replacing a member of the population with a new individual after the current individual has been determined to be invalid. Typically, this is done by replacing the individual with a new one generated by the encoder. But in some cases, it may be desirable to replace the individual in a different way, such as by sampling from the population.