Struct genetic_algorithm::chromosome::Chromosome
source · [−]pub struct Chromosome<T: Genotype> {
pub genes: Vec<T::Allele>,
pub fitness_score: Option<FitnessValue>,
}Expand description
The Chromosome is used as an individual in the Population. It holds the genes and knows how to sort between itself with regard to it’s fitness score. Chromosomes crossover, mutate and compete with each other in the Evolve strategy
Fields
genes: Vec<T::Allele>fitness_score: Option<FitnessValue>Implementations
sourceimpl<T: Genotype> Chromosome<T>
impl<T: Genotype> Chromosome<T>
Trait Implementations
sourceimpl<T: Clone + Genotype> Clone for Chromosome<T>where
T::Allele: Clone,
impl<T: Clone + Genotype> Clone for Chromosome<T>where
T::Allele: Clone,
sourcefn clone(&self) -> Chromosome<T>
fn clone(&self) -> Chromosome<T>
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl<T: Genotype> Display for Chromosome<T>
impl<T: Genotype> Display for Chromosome<T>
sourceimpl<T: Genotype> Ord for Chromosome<T>
impl<T: Genotype> Ord for Chromosome<T>
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<T: Genotype> PartialEq<Chromosome<T>> for Chromosome<T>
impl<T: Genotype> PartialEq<Chromosome<T>> for Chromosome<T>
sourceimpl<T: Genotype> PartialOrd<Chromosome<T>> for Chromosome<T>
impl<T: Genotype> PartialOrd<Chromosome<T>> for Chromosome<T>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: Genotype> Eq for Chromosome<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Chromosome<T>where
<T as Genotype>::Allele: RefUnwindSafe,
impl<T> Send for Chromosome<T>
impl<T> Sync for Chromosome<T>where
<T as Genotype>::Allele: Sync,
impl<T> Unpin for Chromosome<T>where
<T as Genotype>::Allele: Unpin,
impl<T> UnwindSafe for Chromosome<T>where
<T as Genotype>::Allele: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more