pub struct StabilityMonitor {
pub energy_history: Vec<f32>,
pub attempt_count: usize,
pub stable: bool,
pub stability_epsilon: f32,
pub max_retries: usize,
pub retry_policy: RetryPolicy,
}Expand description
Stability monitor for tracking Lyapunov Energy
Fields§
§energy_history: Vec<f32>History of V(x) values
attempt_count: usizeNumber of convergence attempts
stable: boolWhether the node has converged to stability
stability_epsilon: f32Stability threshold (epsilon)
max_retries: usizeMaximum retry attempts before escalation (legacy, use retry_policy)
retry_policy: RetryPolicyRetry policy with PSP-4 compliant limits
Implementations§
Source§impl StabilityMonitor
impl StabilityMonitor
Sourcepub fn new() -> StabilityMonitor
pub fn new() -> StabilityMonitor
Create with default epsilon = 0.1
Sourcepub fn record_energy(&mut self, energy: f32)
pub fn record_energy(&mut self, energy: f32)
Record a new energy value
Sourcepub fn record_failure(&mut self, error_type: ErrorType)
pub fn record_failure(&mut self, error_type: ErrorType)
Record a failure with error type
Sourcepub fn should_escalate(&self) -> bool
pub fn should_escalate(&self) -> bool
Check if we should escalate (exceeded retries without stability)
Sourcepub fn should_escalate_for(&self, error_type: ErrorType) -> bool
pub fn should_escalate_for(&self, error_type: ErrorType) -> bool
Check if we should escalate for a specific error type
Sourcepub fn remaining_attempts(&self) -> usize
pub fn remaining_attempts(&self) -> usize
Get remaining attempts for current error type
Sourcepub fn current_energy(&self) -> f32
pub fn current_energy(&self) -> f32
Get the current energy level (last recorded)
Sourcepub fn is_converging(&self) -> bool
pub fn is_converging(&self) -> bool
Check if energy is decreasing (converging)
Trait Implementations§
Source§impl Clone for StabilityMonitor
impl Clone for StabilityMonitor
Source§fn clone(&self) -> StabilityMonitor
fn clone(&self) -> StabilityMonitor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StabilityMonitor
impl Debug for StabilityMonitor
Source§impl Default for StabilityMonitor
impl Default for StabilityMonitor
Source§fn default() -> StabilityMonitor
fn default() -> StabilityMonitor
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for StabilityMonitor
impl<'de> Deserialize<'de> for StabilityMonitor
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StabilityMonitor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StabilityMonitor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for StabilityMonitor
impl Serialize for StabilityMonitor
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for StabilityMonitor
impl RefUnwindSafe for StabilityMonitor
impl Send for StabilityMonitor
impl Sync for StabilityMonitor
impl Unpin for StabilityMonitor
impl UnwindSafe for StabilityMonitor
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