pub struct BlendCrossover { /* private fields */ }
Expand description
The BlendCrossover is a crossover operator that blends FloatGene alleles from two parent chromosomes to create offspring.
The blending is controlled by the alpha
parameter, which determines the extent of blending between the two alleles.
The formula used for blending is:
new_allele_one = allele_one - (alpha * (allele_two - allele_one))
new_allele_two = allele_two - (alpha * (allele_one - allele_two))
Implementations§
Source§impl BlendCrossover
impl BlendCrossover
Sourcepub fn new(rate: f32, alpha: f32) -> BlendCrossover
pub fn new(rate: f32, alpha: f32) -> BlendCrossover
Create a new instance of the BlendCrossover with the given rate and alpha. The rate must be between 0.0 and 1.0, and the alpha must be between 0.0 and 1.0.
Trait Implementations§
Source§impl Clone for BlendCrossover
impl Clone for BlendCrossover
Source§fn clone(&self) -> BlendCrossover
fn clone(&self) -> BlendCrossover
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<C> Crossover<C> for BlendCrossoverwhere
C: Chromosome<Gene = FloatGene>,
impl<C> Crossover<C> for BlendCrossoverwhere
C: Chromosome<Gene = FloatGene>,
fn rate(&self) -> f32
fn cross_chromosomes( &self, chrom_one: &mut C, chrom_two: &mut C, rate: f32, ) -> AlterResult
fn name(&self) -> String
fn update(&self, _: usize)
fn alterer(self) -> AlterAction<C>where
Self: Sized + 'static,
fn crossover( &self, population: &mut Population<C>, generation: usize, rate: f32, ) -> AlterResult
fn cross( &self, population: &mut Population<C>, parent_indexes: &[usize], generation: usize, rate: f32, ) -> AlterResult
Source§impl Debug for BlendCrossover
impl Debug for BlendCrossover
Source§impl PartialEq for BlendCrossover
impl PartialEq for BlendCrossover
impl StructuralPartialEq for BlendCrossover
Auto Trait Implementations§
impl Freeze for BlendCrossover
impl RefUnwindSafe for BlendCrossover
impl Send for BlendCrossover
impl Sync for BlendCrossover
impl Unpin for BlendCrossover
impl UnwindSafe for BlendCrossover
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more