pub struct Population<C: Chromosome> {
pub chromosomes: Vec<C>,
}
Fields§
§chromosomes: Vec<C>
Implementations§
Source§impl<C: Chromosome> Population<C>
impl<C: Chromosome> Population<C>
pub fn new(chromosomes: Vec<C>) -> Self
pub fn new_empty() -> Self
pub fn size(&self) -> usize
pub fn shuffle<R: Rng>(&mut self, rng: &mut R)
pub fn reset_age(&mut self)
pub fn increment_age(&mut self)
Sourcepub fn best_chromosome(&self, fitness_ordering: FitnessOrdering) -> Option<&C>
pub fn best_chromosome(&self, fitness_ordering: FitnessOrdering) -> Option<&C>
fitness_score is Option and None is least, but invalid as best_chromosome, so filter it out when minimizing the fitness score, otherwise None would end up as best.
pub fn best_chromosome_index( &self, fitness_ordering: FitnessOrdering, ) -> Option<usize>
pub fn age_mean(&self) -> f32
pub fn fitness_score_count(&self) -> usize
pub fn fitness_score_median(&self) -> Option<isize>
pub fn fitness_score_mean(&self) -> f32
pub fn fitness_score_stddev(&self) -> f32
pub fn fitness_score_cardinality(&self) -> Option<usize>
pub fn genes_cardinality(&self) -> Option<usize>
Trait Implementations§
Source§impl<C: Clone + Chromosome> Clone for Population<C>
impl<C: Clone + Chromosome> Clone for Population<C>
Source§fn clone(&self) -> Population<C>
fn clone(&self) -> Population<C>
Returns a copy 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: Debug + Chromosome> Debug for Population<C>
impl<C: Debug + Chromosome> Debug for Population<C>
Source§impl<C: Chromosome> From<Vec<C>> for Population<C>
impl<C: Chromosome> From<Vec<C>> for Population<C>
Auto Trait Implementations§
impl<C> Freeze for Population<C>
impl<C> RefUnwindSafe for Population<C>where
C: RefUnwindSafe,
impl<C> Send for Population<C>
impl<C> Sync for Population<C>where
C: Sync,
impl<C> Unpin for Population<C>where
C: Unpin,
impl<C> UnwindSafe for Population<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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more