Struct genetic_algorithm::strategy::hill_climb::HillClimbState
source · pub struct HillClimbState<G: IncrementalGenotype> {
pub current_iteration: usize,
pub current_generation: usize,
pub stale_generations: usize,
pub best_generation: usize,
pub best_chromosome: Chromosome<G>,
pub durations: HashMap<StrategyAction, Duration>,
pub current_scale_index: Option<usize>,
pub max_scale_index: usize,
pub chromosome: Chromosome<G>,
pub population: Population<G>,
}Expand description
Stores the state of the HillClimb strategy. Next to the expected general fields, the following strategy specific fields are added:
- current_scale_index: current index of IncrementalGenotype’s allele_mutation_scaled_range
- max_scale_index: max index of IncrementalGenotype’s allele_mutation_scaled_range
- contending_chromosome: available for all variants
- neighbouring_population: only available for SteepestAscent variants
Fields§
§current_iteration: usize§current_generation: usize§stale_generations: usize§best_generation: usize§best_chromosome: Chromosome<G>§durations: HashMap<StrategyAction, Duration>§current_scale_index: Option<usize>§max_scale_index: usize§chromosome: Chromosome<G>§population: Population<G>Implementations§
source§impl<G: IncrementalGenotype> HillClimbState<G>
impl<G: IncrementalGenotype> HillClimbState<G>
Trait Implementations§
source§impl<G: IncrementalGenotype> Display for HillClimbState<G>
impl<G: IncrementalGenotype> Display for HillClimbState<G>
source§impl<G: IncrementalGenotype> StrategyState<G> for HillClimbState<G>
impl<G: IncrementalGenotype> StrategyState<G> for HillClimbState<G>
fn chromosome_as_ref(&self) -> &Chromosome<G>
fn chromosome_as_mut(&mut self) -> &mut Chromosome<G>
fn population_as_ref(&self) -> &Population<G>
fn population_as_mut(&mut self) -> &mut Population<G>
fn best_chromosome_as_ref(&self) -> &Chromosome<G>
fn best_generation(&self) -> usize
fn current_generation(&self) -> usize
fn current_iteration(&self) -> usize
fn stale_generations(&self) -> usize
fn increment_stale_generations(&mut self)
fn reset_stale_generations(&mut self)
fn store_best_chromosome(&mut self, improved_fitness: bool) -> (bool, bool)
fn add_duration(&mut self, action: StrategyAction, duration: Duration)
fn total_duration(&self) -> Duration
fn best_fitness_score(&self) -> Option<FitnessValue>
fn close_duration(&mut self, total_duration: Duration)
fn update_best_chromosome( &mut self, fitness_ordering: &FitnessOrdering, replace_on_equal_fitness: bool, ) -> (bool, bool)
Auto Trait Implementations§
impl<G> Freeze for HillClimbState<G>
impl<G> RefUnwindSafe for HillClimbState<G>
impl<G> Send for HillClimbState<G>
impl<G> Sync for HillClimbState<G>
impl<G> Unpin for HillClimbState<G>
impl<G> UnwindSafe for HillClimbState<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> 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