Struct genetic_algorithm::population::Population
source · pub struct Population<T: Genotype> {
pub chromosomes: Vec<Chromosome<T>>,
}
Fields§
§chromosomes: Vec<Chromosome<T>>
Implementations§
source§impl<T: Genotype> Population<T>
impl<T: Genotype> Population<T>
pub fn new(chromosomes: Vec<Chromosome<T>>) -> Self
pub fn new_empty() -> Self
pub fn merge(&mut self, other: &mut Self)
pub fn size(&self) -> usize
pub fn reset_age(&mut self)
pub fn increment_and_filter_age(&mut self, evolve_config: &EvolveConfig)
pub fn trim<R: Rng>(&mut self, remaining_percentage: f32, rng: &mut R)
sourcepub fn best_chromosome(
&self,
fitness_ordering: FitnessOrdering,
) -> Option<&Chromosome<T>>
pub fn best_chromosome( &self, fitness_ordering: FitnessOrdering, ) -> Option<&Chromosome<T>>
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 age_mean(&self) -> f32
pub fn fitness_score_stddev(&self) -> f32
pub fn fitness_score_median(&self) -> Option<isize>
pub fn fitness_score_mean(&self) -> f32
pub fn fitness_score_present(&self, fitness_score: Option<isize>) -> bool
pub fn fitness_score_prevalence(&self, fitness_score: Option<isize>) -> usize
pub fn fitness_score_count(&self) -> usize
pub fn fitness_score_uniformity(&self) -> f32
Trait Implementations§
source§impl<T: Clone + Genotype> Clone for Population<T>
impl<T: Clone + Genotype> Clone for Population<T>
source§fn clone(&self) -> Population<T>
fn clone(&self) -> Population<T>
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<T: Genotype> From<Vec<Chromosome<T>>> for Population<T>
impl<T: Genotype> From<Vec<Chromosome<T>>> for Population<T>
source§fn from(chromosomes: Vec<Chromosome<T>>) -> Self
fn from(chromosomes: Vec<Chromosome<T>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Freeze for Population<T>
impl<T> RefUnwindSafe for Population<T>
impl<T> Send for Population<T>
impl<T> Sync for Population<T>
impl<T> Unpin for Population<T>
impl<T> UnwindSafe for Population<T>
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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