pub struct Genotype<C>where
C: Chromosome,{ /* private fields */ }Expand description
The Genotype struct represents the genetic makeup of an individual. It is a collection of Chromosome instances, it is essentially a light wrapper around a Vec of Chromosomes. The Genotype struct, however, has some additional functionality and terminology that aligns with the biological concept of a genotype. In traditional biological terms, a Genotype is the set of genes in our DNA that determine a specific trait or set of traits. The Genotype is the ‘genetic’ part of the individual that is being evolved by the genetic algorithm.
We can think of a Genotype as a matrix of strucs which implement the Gene trait where each row is a Chromosome.
For example, if we have a Genotype with 2 Chromosomes, each with 3 Genes, it is represented as follows:
Genotype:
[
Chromosome: [Gene, Gene, Gene],
Chromosome: [Gene, Gene, Gene]
]§Type Parameters
C: The type of chromosome used in the genotype, which must implement theChromosometrait.
Implementations§
Source§impl<C> Genotype<C>where
C: Chromosome,
impl<C> Genotype<C>where
C: Chromosome,
pub fn new(chromosomes: Vec<C>) -> Genotype<C>
pub fn len(&self) -> usize
pub fn iter(&self) -> Iter<'_, C>
pub fn iter_mut(&mut self) -> IterMut<'_, C>
pub fn is_empty(&self) -> bool
pub fn get(&self, index: usize) -> Option<&C>
pub fn get_mut(&mut self, index: usize) -> Option<&mut C>
Trait Implementations§
Source§impl<C> Distance<Genotype<C>> for DistanceDiversityAdapter<C>where
C: Chromosome,
impl<C> Distance<Genotype<C>> for DistanceDiversityAdapter<C>where
C: Chromosome,
Source§impl<C> From<C> for Genotype<C>where
C: Chromosome,
impl<C> From<C> for Genotype<C>where
C: Chromosome,
Source§impl<C> FromIterator<C> for Genotype<C>where
C: Chromosome,
impl<C> FromIterator<C> for Genotype<C>where
C: Chromosome,
Source§impl<C> IntoIterator for Genotype<C>where
C: Chromosome,
impl<C> IntoIterator for Genotype<C>where
C: Chromosome,
impl<C> Send for Genotype<C>where
C: Chromosome,
impl<C> StructuralPartialEq for Genotype<C>where
C: Chromosome,
impl<C> Sync for Genotype<C>where
C: Chromosome,
Auto Trait Implementations§
impl<C> Freeze for Genotype<C>
impl<C> RefUnwindSafe for Genotype<C>where
C: RefUnwindSafe,
impl<C> Unpin for Genotype<C>where
C: Unpin,
impl<C> UnwindSafe for Genotype<C>where
C: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I, C> CompactStringExt for C
impl<I, C> CompactStringExt for C
Source§fn concat_compact(self) -> CompactString
fn concat_compact(self) -> CompactString
CompactString Read moreSource§fn join_compact<S>(self, separator: S) -> CompactString
fn join_compact<S>(self, separator: S) -> CompactString
CompactString Read more