pub struct Builder<G: EvolveGenotype + HillClimbGenotype + PermutateGenotype, M: Mutate, F: Fitness<Genotype = G>, S: Crossover, C: Select, E: Extension, SR: StrategyReporter<Genotype = G>> {Show 19 fields
pub genotype: Option<G>,
pub variant: Option<StrategyVariant>,
pub crossover: Option<S>,
pub extension: E,
pub fitness: Option<F>,
pub fitness_ordering: FitnessOrdering,
pub fitness_cache: Option<FitnessCache>,
pub max_chromosome_age: Option<usize>,
pub max_stale_generations: Option<usize>,
pub max_generations: Option<usize>,
pub mutate: Option<M>,
pub par_fitness: bool,
pub replace_on_equal_fitness: bool,
pub reporter: SR,
pub rng_seed: Option<u64>,
pub select: Option<C>,
pub target_fitness_score: Option<FitnessValue>,
pub target_population_size: usize,
pub valid_fitness_score: Option<FitnessValue>,
}Expand description
The superset builder for all strategies.
Note: Only Genotypes which implement all strategies are eligable for the superset builder. RangeGenotype and other floating point range based genotypes currently do not support Permutation unless scaled
Fields§
§genotype: Option<G>§variant: Option<StrategyVariant>§crossover: Option<S>§extension: E§fitness: Option<F>§fitness_ordering: FitnessOrdering§fitness_cache: Option<FitnessCache>§max_chromosome_age: Option<usize>§max_stale_generations: Option<usize>§max_generations: Option<usize>§mutate: Option<M>§par_fitness: bool§replace_on_equal_fitness: bool§reporter: SR§rng_seed: Option<u64>§select: Option<C>§target_fitness_score: Option<FitnessValue>§target_population_size: usize§valid_fitness_score: Option<FitnessValue>Implementations§
Source§impl<G: EvolveGenotype + HillClimbGenotype + PermutateGenotype, M: Mutate<Genotype = G>, F: Fitness<Genotype = G>, S: Crossover<Genotype = G>, C: Select> Builder<G, M, F, S, C, ExtensionNoop<G>, StrategyReporterNoop<G>>
impl<G: EvolveGenotype + HillClimbGenotype + PermutateGenotype, M: Mutate<Genotype = G>, F: Fitness<Genotype = G>, S: Crossover<Genotype = G>, C: Select> Builder<G, M, F, S, C, ExtensionNoop<G>, StrategyReporterNoop<G>>
Source§impl<G: EvolveGenotype + HillClimbGenotype + PermutateGenotype, M: Mutate<Genotype = G>, F: Fitness<Genotype = G>, S: Crossover<Genotype = G>, C: Select<Genotype = G>, E: Extension<Genotype = G>, SR: StrategyReporter<Genotype = G>> Builder<G, M, F, S, C, E, SR>
impl<G: EvolveGenotype + HillClimbGenotype + PermutateGenotype, M: Mutate<Genotype = G>, F: Fitness<Genotype = G>, S: Crossover<Genotype = G>, C: Select<Genotype = G>, E: Extension<Genotype = G>, SR: StrategyReporter<Genotype = G>> Builder<G, M, F, S, C, E, SR>
pub fn with_genotype(self, genotype: G) -> Self
pub fn with_variant(self, variant: StrategyVariant) -> 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_generations(self, max_generations: usize) -> Self
pub fn with_max_generations_option( self, max_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<Genotype = G>>( 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<'a, G: EvolveGenotype + HillClimbGenotype + PermutateGenotype + 'a, M: Mutate<Genotype = G> + 'a, F: Fitness<Genotype = G> + 'a, S: Crossover<Genotype = G> + 'a, C: Select<Genotype = G> + 'a, E: Extension<Genotype = G> + 'a, SR: StrategyReporter<Genotype = G> + 'a> Builder<G, M, F, S, C, E, SR>
impl<'a, G: EvolveGenotype + HillClimbGenotype + PermutateGenotype + 'a, M: Mutate<Genotype = G> + 'a, F: Fitness<Genotype = G> + 'a, S: Crossover<Genotype = G> + 'a, C: Select<Genotype = G> + 'a, E: Extension<Genotype = G> + 'a, SR: StrategyReporter<Genotype = G> + 'a> Builder<G, M, F, S, C, E, SR>
pub fn build(self) -> Result<Box<dyn Strategy<G> + 'a>, TryFromBuilderError>
pub fn to_permutate_builder(self) -> PermutateBuilder<G, F, SR>
pub fn to_evolve_builder(self) -> EvolveBuilder<G, M, F, S, C, E, SR>
pub fn to_hill_climb_builder(self) -> HillClimbBuilder<G, F, SR>
Source§impl<'a, G: EvolveGenotype + HillClimbGenotype + PermutateGenotype + 'a, M: Mutate<Genotype = G> + 'a, F: Fitness<Genotype = G> + 'a, S: Crossover<Genotype = G> + 'a, C: Select<Genotype = G> + 'a, E: Extension<Genotype = G> + 'a, SR: StrategyReporter<Genotype = G> + 'a> Builder<G, M, F, S, C, E, SR>
impl<'a, G: EvolveGenotype + HillClimbGenotype + PermutateGenotype + 'a, M: Mutate<Genotype = G> + 'a, F: Fitness<Genotype = G> + 'a, S: Crossover<Genotype = G> + 'a, C: Select<Genotype = G> + 'a, E: Extension<Genotype = G> + 'a, SR: StrategyReporter<Genotype = G> + 'a> Builder<G, M, F, S, C, E, SR>
pub fn call(self) -> Result<Box<dyn Strategy<G> + 'a>, TryFromBuilderError>
Sourcepub fn call_repeatedly(
self,
max_repeats: usize,
) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
pub fn call_repeatedly( self, max_repeats: usize, ) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
Permutate: call (once) Evolve: call_repeatedly HillClimb: call_repeatedly
Sourcepub fn call_par_repeatedly(
self,
max_repeats: usize,
) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
pub fn call_par_repeatedly( self, max_repeats: usize, ) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
Permutate: call (force with_par_fitness) Evolve: call_par_repeatedly HillClimb: call_par_repeatedly
Sourcepub fn call_speciated(
self,
number_of_species: usize,
) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
pub fn call_speciated( self, number_of_species: usize, ) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
Permutate: call (once) Evolve: call_speciated HillClimb: call_repeatedly
Sourcepub fn call_par_speciated(
self,
number_of_species: usize,
) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
pub fn call_par_speciated( self, number_of_species: usize, ) -> Result<(Box<dyn Strategy<G> + 'a>, Vec<Box<dyn Strategy<G> + 'a>>), TryFromBuilderError>
Permutate: call (force with_par_fitness) Evolve: call_par_speciated HillClimb: call_par_repeatedly
Trait Implementations§
Source§impl<G: Clone + EvolveGenotype + HillClimbGenotype + PermutateGenotype, 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 + HillClimbGenotype + PermutateGenotype, 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 + HillClimbGenotype + PermutateGenotype, 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 + HillClimbGenotype + PermutateGenotype, 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 + HillClimbGenotype + PermutateGenotype, M: Mutate<Genotype = G>, F: Fitness<Genotype = G>, S: Crossover<Genotype = G>, C: Select> Default for Builder<G, M, F, S, C, ExtensionNoop<G>, StrategyReporterNoop<G>>
impl<G: EvolveGenotype + HillClimbGenotype + PermutateGenotype, M: Mutate<Genotype = G>, F: Fitness<Genotype = G>, S: Crossover<Genotype = G>, C: Select> Default for Builder<G, M, F, S, C, ExtensionNoop<G>, StrategyReporterNoop<G>>
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,
S: RefUnwindSafe,
F: RefUnwindSafe,
M: 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,
S: UnwindSafe,
F: UnwindSafe,
M: 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
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>
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>
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