pub struct EvolveBuilder<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> {Show 17 fields
pub genotype: Option<G>,
pub target_population_size: usize,
pub max_stale_generations: Option<usize>,
pub max_chromosome_age: Option<usize>,
pub target_fitness_score: Option<FitnessValue>,
pub valid_fitness_score: Option<FitnessValue>,
pub fitness_ordering: FitnessOrdering,
pub fitness_cache: Option<FitnessCache>,
pub par_fitness: bool,
pub replace_on_equal_fitness: bool,
pub mutate: Option<M>,
pub fitness: Option<F>,
pub crossover: Option<S>,
pub select: Option<C>,
pub extension: E,
pub reporter: SR,
pub rng_seed: Option<u64>,
}
Expand description
The builder for an Evolve struct.
Fields§
§genotype: Option<G>
§target_population_size: usize
§max_stale_generations: Option<usize>
§max_chromosome_age: Option<usize>
§target_fitness_score: Option<FitnessValue>
§valid_fitness_score: Option<FitnessValue>
§fitness_ordering: FitnessOrdering
§fitness_cache: Option<FitnessCache>
§par_fitness: bool
§replace_on_equal_fitness: bool
§mutate: Option<M>
§fitness: Option<F>
§crossover: Option<S>
§select: Option<C>
§extension: E
§reporter: SR
§rng_seed: Option<u64>
Implementations§
Source§impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select> Builder<G, M, F, S, C, ExtensionNoop, StrategyReporterNoop<G>>
impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select> Builder<G, M, F, S, C, ExtensionNoop, StrategyReporterNoop<G>>
Source§impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> Builder<G, M, F, S, C, E, SR>
impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> Builder<G, M, F, S, C, E, SR>
pub fn build(self) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>
pub fn with_genotype(self, genotype: G) -> Self
pub fn with_target_population_size(self, target_population_size: usize) -> Self
pub fn with_max_stale_generations(self, max_stale_generations: usize) -> Self
pub fn with_max_stale_generations_option( self, max_stale_generations_option: Option<usize>, ) -> Self
pub fn with_max_chromosome_age(self, max_chromosome_age: usize) -> Self
pub fn with_max_chromosome_age_option( self, max_chromosome_age_option: Option<usize>, ) -> Self
pub fn with_target_fitness_score( self, target_fitness_score: FitnessValue, ) -> Self
pub fn with_target_fitness_score_option( self, target_fitness_score_option: Option<FitnessValue>, ) -> Self
pub fn with_valid_fitness_score(self, valid_fitness_score: FitnessValue) -> Self
pub fn with_valid_fitness_score_option( self, valid_fitness_score_option: Option<FitnessValue>, ) -> Self
pub fn with_fitness_ordering(self, fitness_ordering: FitnessOrdering) -> Self
Sourcepub fn with_fitness_cache(self, fitness_cache_size: usize) -> Self
pub fn with_fitness_cache(self, fitness_cache_size: usize) -> Self
Only works when genes_hash is stored on chromosome, as this is the cache key. Only useful for long stale runs, but better to increase population diversity. Silently ignore cache_size of zero, to support superset builder which delays specialization
pub fn with_par_fitness(self, par_fitness: bool) -> Self
pub fn with_replace_on_equal_fitness( self, replace_on_equal_fitness: bool, ) -> Self
pub fn with_mutate(self, mutate: M) -> Self
pub fn with_fitness(self, fitness: F) -> Self
pub fn with_crossover(self, crossover: S) -> Self
pub fn with_select(self, select: C) -> Self
pub fn with_extension<E2: Extension>( self, extension: E2, ) -> Builder<G, M, F, S, C, E2, SR>
pub fn with_reporter<SR2: StrategyReporter<Genotype = G>>( self, reporter: SR2, ) -> Builder<G, M, F, S, C, E, SR2>
pub fn with_rng_seed_from_u64(self, rng_seed: u64) -> Self
pub fn with_rng_seed_from_u64_option(self, rng_seed_option: Option<u64>) -> Self
Source§impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> Builder<G, M, F, S, C, E, SR>
impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> Builder<G, M, F, S, C, E, SR>
pub fn rng(&self) -> SmallRng
pub fn call(self) -> Result<Evolve<G, M, F, S, C, E, SR>, TryFromBuilderError>
pub fn call_repeatedly( self, max_repeats: usize, ) -> Result<(Evolve<G, M, F, S, C, E, SR>, Vec<Evolve<G, M, F, S, C, E, SR>>), TryFromBuilderError>
pub fn call_par_repeatedly( self, max_repeats: usize, ) -> Result<(Evolve<G, M, F, S, C, E, SR>, Vec<Evolve<G, M, F, S, C, E, SR>>), TryFromBuilderError>
pub fn call_speciated( self, number_of_species: usize, ) -> Result<(Evolve<G, M, F, S, C, E, SR>, Vec<Evolve<G, M, F, S, C, E, SR>>), TryFromBuilderError>
pub fn call_par_speciated( self, number_of_species: usize, ) -> Result<(Evolve<G, M, F, S, C, E, SR>, Vec<Evolve<G, M, F, S, C, E, SR>>), TryFromBuilderError>
pub fn extract_best_run( &self, runs: &mut Vec<Evolve<G, M, F, S, C, E, SR>>, ) -> Evolve<G, M, F, S, C, E, SR>
Trait Implementations§
Source§impl<G: Clone + EvolveGenotype, M: Clone + Mutate, F: Clone + Fitness<Genotype = G>, S: Clone + Crossover, C: Clone + Select, E: Clone + Extension, SR: Clone + StrategyReporter<Genotype = G>> Clone for Builder<G, M, F, S, C, E, SR>
impl<G: Clone + EvolveGenotype, M: Clone + Mutate, F: Clone + Fitness<Genotype = G>, S: Clone + Crossover, C: Clone + Select, E: Clone + Extension, SR: Clone + StrategyReporter<Genotype = G>> Clone for Builder<G, M, F, S, C, E, SR>
Source§impl<G: Debug + EvolveGenotype, M: Debug + Mutate, F: Debug + Fitness<Genotype = G>, S: Debug + Crossover, C: Debug + Select, E: Debug + Extension, SR: Debug + StrategyReporter<Genotype = G>> Debug for Builder<G, M, F, S, C, E, SR>
impl<G: Debug + EvolveGenotype, M: Debug + Mutate, F: Debug + Fitness<Genotype = G>, S: Debug + Crossover, C: Debug + Select, E: Debug + Extension, SR: Debug + StrategyReporter<Genotype = G>> Debug for Builder<G, M, F, S, C, E, SR>
Source§impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select> Default for Builder<G, M, F, S, C, ExtensionNoop, StrategyReporterNoop<G>>
impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select> Default for Builder<G, M, F, S, C, ExtensionNoop, StrategyReporterNoop<G>>
Source§impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> TryFrom<Builder<G, M, F, S, C, E, SR>> for Evolve<G, M, F, S, C, E, SR>
impl<G: EvolveGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> TryFrom<Builder<G, M, F, S, C, E, SR>> for Evolve<G, M, F, S, C, E, SR>
Source§type Error = TryFromStrategyBuilderError
type Error = TryFromStrategyBuilderError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<G, M, F, S, C, E, SR> Freeze for Builder<G, M, F, S, C, E, SR>
impl<G, M, F, S, C, E, SR> RefUnwindSafe for Builder<G, M, F, S, C, E, SR>where
E: RefUnwindSafe,
SR: RefUnwindSafe,
G: RefUnwindSafe,
M: RefUnwindSafe,
F: RefUnwindSafe,
S: RefUnwindSafe,
C: RefUnwindSafe,
impl<G, M, F, S, C, E, SR> Send for Builder<G, M, F, S, C, E, SR>
impl<G, M, F, S, C, E, SR> Sync for Builder<G, M, F, S, C, E, SR>
impl<G, M, F, S, C, E, SR> Unpin for Builder<G, M, F, S, C, E, SR>
impl<G, M, F, S, C, E, SR> UnwindSafe for Builder<G, M, F, S, C, E, SR>where
E: UnwindSafe,
SR: UnwindSafe,
G: UnwindSafe,
M: UnwindSafe,
F: UnwindSafe,
S: UnwindSafe,
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