pub struct EventDrivenOptimizer<T: Float + Debug + Send + Sync + 'static> { /* private fields */ }Expand description
Event-driven optimizer
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static + Sum + ScalarOperand + AddAssign> EventDrivenOptimizer<T>
impl<T: Float + Debug + Send + Sync + 'static + Sum + ScalarOperand + AddAssign> EventDrivenOptimizer<T>
Sourcepub fn new(
config: EventDrivenConfig<T>,
stdp_config: STDPConfig<T>,
membrane_config: MembraneDynamicsConfig<T>,
num_neurons: usize,
) -> Self
pub fn new( config: EventDrivenConfig<T>, stdp_config: STDPConfig<T>, membrane_config: MembraneDynamicsConfig<T>, num_neurons: usize, ) -> Self
Create a new event-driven optimizer
Sourcepub fn enqueue_event(&mut self, event: NeuromorphicEvent<T>) -> Result<()>
pub fn enqueue_event(&mut self, event: NeuromorphicEvent<T>) -> Result<()>
Add event to the processing queue.
With config.event_compression enabled the event is compressed to
bytes here and only those bytes are retained (F57): the live queue
really does store compressed frames instead of whole events, and the
event is reconstructed lazily in Self::pop_next_event when it is
about to be processed.
Sourcepub fn process_events(&mut self) -> Result<usize>
pub fn process_events(&mut self) -> Result<usize>
Process events from the queue
Sourcepub fn get_event_statistics(&self) -> &HashMap<EventType, EventStatistics<T>>
pub fn get_event_statistics(&self) -> &HashMap<EventType, EventStatistics<T>>
Get event processing statistics
Sourcepub fn get_system_state(&self) -> &SystemState<T>
pub fn get_system_state(&self) -> &SystemState<T>
Get current system state
Sourcepub fn get_metrics(&self) -> &NeuromorphicMetrics<T>
pub fn get_metrics(&self) -> &NeuromorphicMetrics<T>
Get current metrics
Sourcepub fn clear_event_queue(&mut self)
pub fn clear_event_queue(&mut self)
Clear event queue, including any compressed frames still pending.
Sourcepub fn get_queue_size(&self) -> usize
pub fn get_queue_size(&self) -> usize
Get queue size: events waiting in the in-memory priority queue plus events waiting as compressed frames.
Sourcepub fn compressed_queue_bytes(&self) -> usize
pub fn compressed_queue_bytes(&self) -> usize
Bytes currently occupied by the compressed event queue (F57). Zero
while config.event_compression is disabled, since nothing is stored
in compressed form then.
Sourcepub fn compression_statistics(&self) -> (usize, usize)
pub fn compression_statistics(&self) -> (usize, usize)
Cumulative (uncompressed_bytes, compressed_bytes) measured across
every event that has entered the compressed queue since construction.
The uncompressed figure is the size the same event occupies under the
reference (EventCompressionAlgorithm::None) codec, so the pair is a
direct measurement of what compression actually achieved.
Sourcepub fn compression_ratio(&self) -> Option<f64>
pub fn compression_ratio(&self) -> Option<f64>
Achieved compression ratio (compressed / uncompressed); None until
at least one event has been compressed.
Sourcepub fn last_measured_event_rate(&self) -> Option<T>
pub fn last_measured_event_rate(&self) -> Option<T>
The most recent measured event-processing rate (events per second)
recorded by Self::process_events, or None if no interval long
enough to be measurable has been observed yet. Always finite: the
previous implementation divided the processed count by an integer
millisecond count, which is zero for any batch finishing inside one
clock tick, feeding inf/NaN into the adaptive handler.
Sourcepub fn current_adaptation_factor(&self) -> T
pub fn current_adaptation_factor(&self) -> T
The adaptation factor currently chosen by the adaptive event handler from the measured event-processing rate history (0.5 while throughput is degrading, 1.0 while it is stable, 1.5 while it is improving).
Sourcepub fn adaptive_batch_size(&self) -> usize
pub fn adaptive_batch_size(&self) -> usize
Effective per-iteration batch size: the configured batch_size scaled
by Self::current_adaptation_factor, so a system whose measured
throughput is improving takes larger bites and one that is degrading
takes smaller ones. Never zero.
Sourcepub fn event_correlation(&self, first: EventType, second: EventType) -> T
pub fn event_correlation(&self, first: EventType, second: EventType) -> T
Measured temporal correlation between two event types, as accumulated by the correlation tracker over the configured correlation window.
The tracker genuinely computes and stores these strengths; before this accessor existed there was no way to read any of them back.
Sourcepub fn worker_loads(&self) -> Option<Vec<(usize, T)>>
pub fn worker_loads(&self) -> Option<Vec<(usize, T)>>
Per-worker event counts recorded by the distributed coordinator, or
None when distributed processing is disabled.
Sourcepub fn enable_distributed_processing(&mut self, num_workers: usize)
pub fn enable_distributed_processing(&mut self, num_workers: usize)
Enable distributed processing
Sourcepub fn disable_distributed_processing(&mut self)
pub fn disable_distributed_processing(&mut self)
Disable distributed processing
Auto Trait Implementations§
impl<T> !RefUnwindSafe for EventDrivenOptimizer<T>
impl<T> !UnwindSafe for EventDrivenOptimizer<T>
impl<T> Freeze for EventDrivenOptimizer<T>where
T: Freeze,
impl<T> Send for EventDrivenOptimizer<T>
impl<T> Sync for EventDrivenOptimizer<T>
impl<T> Unpin for EventDrivenOptimizer<T>where
T: Unpin,
impl<T> UnsafeUnpin for EventDrivenOptimizer<T>where
T: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.