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: impl Into<Rate>, alpha: f32) -> BlendCrossover
pub fn new(rate: impl Into<Rate>, 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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<A, G, C> Crossover<C> for BlendCrossover
impl<A, G, C> Crossover<C> for BlendCrossover
fn rate(&self) -> Rate
fn cross_chromosomes( &self, chrom_one: &mut C, chrom_two: &mut C, ctx: &mut AlterContext<'_>, ) -> AlterResult
fn name(&self) -> String
fn alterer(self) -> Alterer<C>where
Self: Sized + 'static,
fn crossover( &self, population: &mut [Phenotype<C>], ctx: &mut AlterContext<'_>, ) -> AlterResult
fn cross( &self, population: &mut [Phenotype<C>], parent_indexes: &[usize], ctx: &mut AlterContext<'_>, ) -> AlterResult
Source§impl Debug for BlendCrossover
impl Debug for BlendCrossover
Source§impl PartialEq for BlendCrossover
impl PartialEq for BlendCrossover
Source§fn eq(&self, other: &BlendCrossover) -> bool
fn eq(&self, other: &BlendCrossover) -> bool
Tests for
self and other values to be equal, and is used by ==.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 UnsafeUnpin 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