pub struct EpState<B: Backend> {
pub parents: Tensor<B, 2>,
pub sigmas: Tensor<B, 1>,
pub parent_fitness: Vec<f32>,
pub best_genome: Option<Tensor<B, 2>>,
pub best_fitness: f32,
pub generation: usize,
}Expand description
Generation-to-generation state for EvolutionaryProgramming.
The two-phase ask/tell handshake uses parent_fitness.is_empty() as
a sentinel: on the very first Strategy::ask call the initial
parents are returned unchanged; on the very first Strategy::tell
call parent_fitness is populated and
best_genome/best_fitness are initialized. Subsequent
ask/tell cycles produce, evaluate, and select from the (μ + μ) pool.
During ask, sigmas is temporarily expanded to length 2μ (parent
σ concatenated with offspring σ) so tell can apply q-tournament
selection over the combined pool without re-deriving σ values. After
tell completes, sigmas is back to length μ.
Fields§
§parents: Tensor<B, 2>Current parents, shape (μ, D).
sigmas: Tensor<B, 1>Per-individual step-size σ, shape (μ,) between generations and
(2μ,) transiently inside an ask/tell cycle (parent σ ‖ offspring σ).
parent_fitness: Vec<f32>Host-side fitness cache for the current parents.
Empty before the first Strategy::tell call; length μ
thereafter. The is_empty() check distinguishes the initial
evaluation phase from subsequent tournament-selection generations.
best_genome: Option<Tensor<B, 2>>Best-so-far genome, shape (1, D).
None before the first Strategy::tell call.
best_fitness: f32Best-so-far fitness across all completed generations.
f32::NEG_INFINITY before the first Strategy::tell call
(the worst value under the maximise convention).
generation: usizeNumber of completed tell calls (zero-based generation index + 1).
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for EpState<B>where
<B as BackendTypes>::FloatTensorPrimitive: Freeze,
<B as BackendTypes>::QuantizedTensorPrimitive: Freeze,
impl<B> RefUnwindSafe for EpState<B>where
<B as BackendTypes>::FloatTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: RefUnwindSafe,
impl<B> Send for EpState<B>
impl<B> Sync for EpState<B>
impl<B> Unpin for EpState<B>where
<B as BackendTypes>::FloatTensorPrimitive: Unpin,
<B as BackendTypes>::QuantizedTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for EpState<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::QuantizedTensorPrimitive: UnsafeUnpin,
impl<B> UnwindSafe for EpState<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: 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<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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