pub struct SimpleGaRun<G, F = f64>where
G: EvolutionaryGenome,
F: FitnessValue,{ /* private fields */ }Expand description
Mutable state for driving a SimpleGA one generation at a time.
Produced by SimpleGA::init_run, advanced by
SimpleGA::step_generation, and consumed by SimpleGA::finish_run. This
is the incremental counterpart to SimpleGA::run (AUDIT EV-34): callers can
drive the generation loop, read progress via the getters below, and cancel
early — all without changing run’s behavior, since run is implemented in
terms of these methods.
Available in all builds (not gated on the parallel feature) so the
checkpoint resume API (EV-02) and WASM stepping bindings (EV-34) work
regardless of feature flags.
Implementations§
Source§impl<G, F> SimpleGaRun<G, F>where
G: EvolutionaryGenome,
F: FitnessValue,
impl<G, F> SimpleGaRun<G, F>where
G: EvolutionaryGenome,
F: FitnessValue,
Sourcepub fn generation(&self) -> usize
pub fn generation(&self) -> usize
Number of generations completed so far.
Sourcepub fn evaluations(&self) -> usize
pub fn evaluations(&self) -> usize
Total fitness evaluations performed so far.
Sourcepub fn best_fitness(&self) -> f64
pub fn best_fitness(&self) -> f64
Best fitness found so far (as f64).
Sourcepub fn best_genome(&self) -> &G
pub fn best_genome(&self) -> &G
The best genome found so far.
Sourcepub fn fitness_history(&self) -> &[f64]
pub fn fitness_history(&self) -> &[f64]
Per-generation best-so-far fitness trajectory (index 0 is generation 0).
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
true once the termination criterion has fired.
Sourcepub fn best_genomes(&self, k: usize) -> Vec<G>
pub fn best_genomes(&self, k: usize) -> Vec<G>
Clone the best k genomes in the current population (best first).
Used to select emigrants for island-model migration (AUDIT EV-77).
Auto Trait Implementations§
impl<G, F> Freeze for SimpleGaRun<G, F>
impl<G, F> RefUnwindSafe for SimpleGaRun<G, F>where
G: RefUnwindSafe,
F: RefUnwindSafe,
impl<G, F> Send for SimpleGaRun<G, F>
impl<G, F> Sync for SimpleGaRun<G, F>
impl<G, F> Unpin for SimpleGaRun<G, F>
impl<G, F> UnsafeUnpin for SimpleGaRun<G, F>where
G: UnsafeUnpin,
F: UnsafeUnpin,
impl<G, F> UnwindSafe for SimpleGaRun<G, F>where
G: UnwindSafe,
F: 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> 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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.