Operators Reference

Genetic operators for selection, crossover, and mutation.

Overview

CategoryPurposeTrait
SelectionChoose parentsSelectionOperator
CrossoverCombine parentsCrossoverOperator
MutationAdd variationMutationOperator

Operator Traits

Selection

pub trait SelectionOperator<G>: Send + Sync {
    fn select<R: Rng>(&self, population: &[(G, f64)], rng: &mut R) -> usize;
}

Crossover

pub trait CrossoverOperator<G>: Send + Sync {
    type Output;
    fn crossover<R: Rng>(&self, p1: &G, p2: &G, rng: &mut R) -> Self::Output;
}

// For bounded genomes
pub trait BoundedCrossoverOperator<G>: Send + Sync {
    type Output;
    fn crossover_bounded<R: Rng>(
        &self, p1: &G, p2: &G, bounds: &MultiBounds, rng: &mut R
    ) -> Self::Output;
}

Mutation

pub trait MutationOperator<G>: Send + Sync {
    fn mutate<R: Rng>(&self, genome: &mut G, rng: &mut R);
}

// For bounded genomes
pub trait BoundedMutationOperator<G>: Send + Sync {
    fn mutate_bounded<R: Rng>(
        &self, genome: &mut G, bounds: &MultiBounds, rng: &mut R
    );
}

Operator Selection Guide

For RealVector

OperationRecommendedAlternative
SelectionTournamentSelection(3-5)RankSelection
CrossoverSbxCrossover(15-25)BlendCrossover(0.5)
MutationPolynomialMutation(15-25)GaussianMutation(0.1)

For BitString

OperationRecommendedAlternative
SelectionTournamentSelection(3)RouletteWheelSelection
CrossoverUniformCrossoverOnePointCrossover
MutationBitFlipMutation(0.01)-

For Permutation

OperationRecommendedAlternative
SelectionTournamentSelection(5)-
CrossoverOrderCrossoverPmxCrossover
MutationInversionMutationSwapMutation

See Also