Struct genetic_algorithm::genotype::GenotypeBuilder
source · pub struct GenotypeBuilder<G: Genotype> {
pub genes_size: Option<usize>,
pub allele_list: Option<Vec<G::Allele>>,
pub allele_lists: Option<Vec<Vec<G::Allele>>>,
pub allele_range: Option<RangeInclusive<G::Allele>>,
pub allele_ranges: Option<Vec<RangeInclusive<G::Allele>>>,
pub allele_mutation_range: Option<RangeInclusive<G::Allele>>,
pub allele_mutation_ranges: Option<Vec<RangeInclusive<G::Allele>>>,
pub allele_mutation_scaled_range: Option<Vec<RangeInclusive<G::Allele>>>,
pub allele_mutation_scaled_ranges: Option<Vec<Vec<RangeInclusive<G::Allele>>>>,
pub seed_genes_list: Vec<G::Genes>,
}
Expand description
The builder for a Genotype struct
Shared initialization options for all Genotypes:
- Builder
with_seed_genes_list(Vec<Genotype::Genes>)
, optional, list of start genes of all chromosomes which are distributed randomly in the population (instead of the default random genes). Sometimes it is efficient to start with a certain population
Fields§
§genes_size: Option<usize>
§allele_list: Option<Vec<G::Allele>>
§allele_lists: Option<Vec<Vec<G::Allele>>>
§allele_range: Option<RangeInclusive<G::Allele>>
§allele_ranges: Option<Vec<RangeInclusive<G::Allele>>>
§allele_mutation_range: Option<RangeInclusive<G::Allele>>
§allele_mutation_ranges: Option<Vec<RangeInclusive<G::Allele>>>
§allele_mutation_scaled_range: Option<Vec<RangeInclusive<G::Allele>>>
§allele_mutation_scaled_ranges: Option<Vec<Vec<RangeInclusive<G::Allele>>>>
§seed_genes_list: Vec<G::Genes>
Implementations§
source§impl<G: Genotype> Builder<G>
impl<G: Genotype> Builder<G>
pub fn new() -> Self
pub fn with_genes_size(self, genes_size: usize) -> Self
pub fn with_allele_list(self, allele_list: Vec<G::Allele>) -> Self
pub fn with_allele_lists(self, allele_lists: Vec<Vec<G::Allele>>) -> Self
pub fn with_allele_range(self, allele_range: RangeInclusive<G::Allele>) -> Self
pub fn with_allele_ranges( self, allele_ranges: Vec<RangeInclusive<G::Allele>>, ) -> Self
pub fn with_allele_mutation_range( self, allele_mutation_range: RangeInclusive<G::Allele>, ) -> Self
pub fn with_allele_mutation_ranges( self, allele_mutation_ranges: Vec<RangeInclusive<G::Allele>>, ) -> Self
pub fn with_allele_mutation_scaled_range( self, allele_mutation_scaled_range: Vec<RangeInclusive<G::Allele>>, ) -> Self
pub fn with_allele_mutation_scaled_ranges( self, allele_mutation_scaled_ranges: Vec<Vec<RangeInclusive<G::Allele>>>, ) -> Self
pub fn with_seed_genes_list(self, seed_genes_list: Vec<G::Genes>) -> Self
pub fn build(self) -> Result<G, <G as TryFrom<Builder<G>>>::Error>
Trait Implementations§
source§impl<T> TryFrom<Builder<MultiRange<T>>> for MultiRange<T>where
T: SampleUniform + Allele + Into<f64> + Add<Output = T> + PartialOrd,
Uniform<T>: Send + Sync,
impl<T> TryFrom<Builder<MultiRange<T>>> for MultiRange<T>where
T: SampleUniform + Allele + Into<f64> + Add<Output = T> + PartialOrd,
Uniform<T>: Send + Sync,
source§impl<T: Allele> TryFrom<Builder<MultiUnique<T>>> for MultiUnique<T>
impl<T: Allele> TryFrom<Builder<MultiUnique<T>>> for MultiUnique<T>
Auto Trait Implementations§
impl<G> Freeze for Builder<G>
impl<G> RefUnwindSafe for Builder<G>
impl<G> Send for Builder<G>
impl<G> Sync for Builder<G>
impl<G> Unpin for Builder<G>
impl<G> UnwindSafe for Builder<G>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
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