pub struct OscillationDetector {
pub window: usize,
pub min_alternations: usize,
}Expand description
Detect oscillation on a specific knob across recent steps.
“Oscillation” = the knob’s (after - before) delta has been
sign-alternating across the configured window of the most
recent steps that actually touched this knob. When that
happens, the optimizer is bouncing between two values and the
loop should reduce damping (or warn) rather than keep
proposing the same step direction.
Fields§
§window: usizeHow many recent same-knob steps to scan. Default 5.
min_alternations: usizeMinimum alternations needed within the window to flag oscillation. Default 3 (≥ 3 sign-changes in 5 steps).
Implementations§
Source§impl OscillationDetector
impl OscillationDetector
Sourcepub fn check(&self, history: &[StepReport], knob_path: &str) -> bool
pub fn check(&self, history: &[StepReport], knob_path: &str) -> bool
Return true if knob_path is oscillating per the
configured window + alternation threshold. Skips steps
whose patch didn’t touch knob_path and steps that didn’t
apply a patch at all. Returns false when fewer than
window qualifying steps exist.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OscillationDetector
impl RefUnwindSafe for OscillationDetector
impl Send for OscillationDetector
impl Sync for OscillationDetector
impl Unpin for OscillationDetector
impl UnsafeUnpin for OscillationDetector
impl UnwindSafe for OscillationDetector
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> 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<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.