pub struct InversionMutator { /* private fields */ }
Expand description
The InversionMutator is a simple mutator that inverts a random section of the chromosome.
Because the slice of the chromosome is of random length, with small chromosomes, the inversion may not be very effective. This mutator is best used with larger chromosomes.
Implementations§
Source§impl InversionMutator
impl InversionMutator
Sourcepub fn new(rate: f32) -> InversionMutator
pub fn new(rate: f32) -> InversionMutator
Create a new instance of the InversionMutator with the given rate. The rate must be between 0.0 and 1.0.
Trait Implementations§
Source§impl Clone for InversionMutator
impl Clone for InversionMutator
Source§fn clone(&self) -> InversionMutator
fn clone(&self) -> InversionMutator
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 Debug for InversionMutator
impl Debug for InversionMutator
Source§impl<C> Mutate<C> for InversionMutatorwhere
C: Chromosome,
impl<C> Mutate<C> for InversionMutatorwhere
C: Chromosome,
fn rate(&self) -> f32
fn mutate_chromosome(&self, chromosome: &mut C, rate: f32) -> AlterResult
fn name(&self) -> String
fn update(&self, _: usize)
fn alterer(self) -> AlterAction<C>where
Self: Sized + 'static,
fn mutate( &self, population: &mut Population<C>, generation: usize, rate: f32, ) -> AlterResult
fn mutate_genotype(&self, genotype: &mut Genotype<C>, rate: f32) -> AlterResult
fn mutate_gene(&self, gene: &<C as Chromosome>::Gene) -> <C as Chromosome>::Gene
Auto Trait Implementations§
impl Freeze for InversionMutator
impl RefUnwindSafe for InversionMutator
impl Send for InversionMutator
impl Sync for InversionMutator
impl Unpin for InversionMutator
impl UnwindSafe for InversionMutator
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