pub struct EvolutionMemory { /* private fields */ }Expand description
Memory for evolution experiments with importance-based learning
Unlike a simple vector of experiments, EvolutionMemory:
- Weights recent experiments higher
- Keeps high-fitness experiments longer
- Learns trait-performance correlations
- Suggests trait adjustments based on patterns
§Security
Uses VecDeque for O(1) insertion and bounded capacity to prevent DoS attacks.
Implementations§
Source§impl EvolutionMemory
impl EvolutionMemory
Sourcepub fn with_capacity(max_entries: usize) -> Self
pub fn with_capacity(max_entries: usize) -> Self
Create with custom capacity
Sourcepub fn record(&mut self, experiment: GenomeExperiment)
pub fn record(&mut self, experiment: GenomeExperiment)
Record a genome experiment
High-fitness experiments get higher importance and are kept longer.
§Security
Uses VecDeque::push_front for O(1) insertion (DoS prevention).
Sourcepub fn get_top_experiments(&self, limit: usize) -> Vec<&GenomeExperiment>
pub fn get_top_experiments(&self, limit: usize) -> Vec<&GenomeExperiment>
Get top experiments by importance (recency + fitness)
Sourcepub fn experiments(&self) -> impl Iterator<Item = &GenomeExperiment>
pub fn experiments(&self) -> impl Iterator<Item = &GenomeExperiment>
Get all experiments
Sourcepub fn correlations(&self) -> &HashMap<String, f64>
pub fn correlations(&self) -> &HashMap<String, f64>
Get learned trait correlations
Sourcepub fn get_experiments_snapshot(&self) -> Vec<GenomeExperiment>
pub fn get_experiments_snapshot(&self) -> Vec<GenomeExperiment>
Get a snapshot of all experiments (for consolidation)
Sourcepub fn get_experiments_oldest(&self, count: usize) -> Vec<GenomeExperiment>
pub fn get_experiments_oldest(&self, count: usize) -> Vec<GenomeExperiment>
Get snapshot of the oldest N experiments
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear all experiments (after consolidation) Note: Keeps learned correlations map intact until new data arrives.
Sourcepub fn drain_oldest(&mut self, count: usize)
pub fn drain_oldest(&mut self, count: usize)
Remove the oldest N experiments (safer than clear)
Sourcepub fn suggest_adjustments(&self, current: &Genome) -> Vec<TraitAdjustment>
pub fn suggest_adjustments(&self, current: &Genome) -> Vec<TraitAdjustment>
Suggest trait adjustments based on learned correlations
Sourcepub fn apply_decay(&mut self, decay_factor: f64)
pub fn apply_decay(&mut self, decay_factor: f64)
Apply temporal decay to all experiments (call periodically)
Trait Implementations§
Source§impl Clone for EvolutionMemory
impl Clone for EvolutionMemory
Source§fn clone(&self) -> EvolutionMemory
fn clone(&self) -> EvolutionMemory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EvolutionMemory
impl Debug for EvolutionMemory
Source§impl Default for EvolutionMemory
impl Default for EvolutionMemory
Source§fn default() -> EvolutionMemory
fn default() -> EvolutionMemory
Auto Trait Implementations§
impl Freeze for EvolutionMemory
impl RefUnwindSafe for EvolutionMemory
impl Send for EvolutionMemory
impl Sync for EvolutionMemory
impl Unpin for EvolutionMemory
impl UnsafeUnpin for EvolutionMemory
impl UnwindSafe for EvolutionMemory
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> 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