Skip to main content

should_switch

Function should_switch 

Source
pub fn should_switch(
    incumbent_score: f64,
    challenger_score: f64,
    hysteresis: f64,
) -> bool
Expand description

Whether a challenger layout should displace the incumbent, given a hysteresis margin it must clear: challenger > incumbent + hysteresis.

The margin is the anti-thrash / dwell mechanism (set it to the amortised repack cost): without it a controller chatters between two near-equal layouts, paying the switch cost each time. (OREO’s α-gate and switched-system hysteresis converge on the same “switch rarely” rule.)