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)
Sourcepub fn reset_for_replan(&mut self)
pub fn reset_for_replan(&mut self)
Reset monitor state for a subgraph replan, preserving history but clearing attempt count and stability flag so the node can be retried.
Trait Implementations§
Source§impl Clone for StabilityMonitor
impl Clone for StabilityMonitor
Source§fn clone(&self) -> StabilityMonitor
fn clone(&self) -> StabilityMonitor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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>,
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,
Auto Trait Implementations§
impl Freeze for StabilityMonitor
impl RefUnwindSafe for StabilityMonitor
impl Send for StabilityMonitor
impl Sync for StabilityMonitor
impl Unpin for StabilityMonitor
impl UnsafeUnpin 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
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