pub struct HillClimbBuilder<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> {Show 13 fields
pub genotype: Option<G>,
pub variant: Option<HillClimbVariant>,
pub fitness: Option<F>,
pub fitness_ordering: FitnessOrdering,
pub fitness_cache: Option<FitnessCache>,
pub par_fitness: bool,
pub max_stale_generations: Option<usize>,
pub max_generations: Option<usize>,
pub target_fitness_score: Option<FitnessValue>,
pub valid_fitness_score: Option<FitnessValue>,
pub replace_on_equal_fitness: bool,
pub reporter: SR,
pub rng_seed: Option<u64>,
}
Expand description
The builder for an HillClimb struct.
Fields§
§genotype: Option<G>
§variant: Option<HillClimbVariant>
§fitness: Option<F>
§fitness_ordering: FitnessOrdering
§fitness_cache: Option<FitnessCache>
§par_fitness: bool
§max_stale_generations: Option<usize>
§max_generations: Option<usize>
§target_fitness_score: Option<FitnessValue>
§valid_fitness_score: Option<FitnessValue>
§replace_on_equal_fitness: bool
§reporter: SR
§rng_seed: Option<u64>
Implementations§
Source§impl<G: HillClimbGenotype, F: Fitness<Genotype = G>> Builder<G, F, StrategyReporterNoop<G>>
impl<G: HillClimbGenotype, F: Fitness<Genotype = G>> Builder<G, F, StrategyReporterNoop<G>>
Source§impl<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> Builder<G, F, SR>
impl<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> Builder<G, F, SR>
pub fn build(self) -> Result<HillClimb<G, F, SR>, TryFromBuilderError>
pub fn with_genotype(self, genotype: G) -> Self
pub fn with_variant(self, variant: HillClimbVariant) -> 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. 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_fitness(self, fitness: F) -> 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_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_replace_on_equal_fitness( self, replace_on_equal_fitness: bool, ) -> Self
pub fn with_reporter<SR2: StrategyReporter<Genotype = G>>( self, reporter: SR2, ) -> Builder<G, F, 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: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> Builder<G, F, SR>
impl<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> Builder<G, F, SR>
pub fn rng(&self) -> SmallRng
pub fn call(self) -> Result<HillClimb<G, F, SR>, TryFromBuilderError>
pub fn call_repeatedly( self, max_repeats: usize, ) -> Result<(HillClimb<G, F, SR>, Vec<HillClimb<G, F, SR>>), TryFromBuilderError>
pub fn call_par_repeatedly( self, max_repeats: usize, ) -> Result<(HillClimb<G, F, SR>, Vec<HillClimb<G, F, SR>>), TryFromBuilderError>
pub fn extract_best_run( &self, runs: &mut Vec<HillClimb<G, F, SR>>, ) -> HillClimb<G, F, SR>
Trait Implementations§
Source§impl<G: Clone + HillClimbGenotype, F: Clone + Fitness<Genotype = G>, SR: Clone + StrategyReporter<Genotype = G>> Clone for Builder<G, F, SR>
impl<G: Clone + HillClimbGenotype, F: Clone + Fitness<Genotype = G>, SR: Clone + StrategyReporter<Genotype = G>> Clone for Builder<G, F, SR>
Source§impl<G: Debug + HillClimbGenotype, F: Debug + Fitness<Genotype = G>, SR: Debug + StrategyReporter<Genotype = G>> Debug for Builder<G, F, SR>
impl<G: Debug + HillClimbGenotype, F: Debug + Fitness<Genotype = G>, SR: Debug + StrategyReporter<Genotype = G>> Debug for Builder<G, F, SR>
Source§impl<G: HillClimbGenotype, F: Fitness<Genotype = G>> Default for Builder<G, F, StrategyReporterNoop<G>>
impl<G: HillClimbGenotype, F: Fitness<Genotype = G>> Default for Builder<G, F, StrategyReporterNoop<G>>
Source§impl<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> TryFrom<Builder<G, F, SR>> for HillClimb<G, F, SR>
impl<G: HillClimbGenotype, F: Fitness<Genotype = G>, SR: StrategyReporter<Genotype = G>> TryFrom<Builder<G, F, SR>> for HillClimb<G, F, SR>
Source§type Error = TryFromStrategyBuilderError
type Error = TryFromStrategyBuilderError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<G, F, SR> Freeze for Builder<G, F, SR>
impl<G, F, SR> RefUnwindSafe for Builder<G, F, SR>
impl<G, F, SR> Send for Builder<G, F, SR>
impl<G, F, SR> Sync for Builder<G, F, SR>
impl<G, F, SR> Unpin for Builder<G, F, SR>
impl<G, F, SR> UnwindSafe for Builder<G, F, SR>
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