pub struct DynRouter {
pub skills: Vec<RoutableSkill>,
pub e_on: f32,
pub e_off: f32,
pub margin: f32,
pub period: usize,
pub switches: Vec<(usize, Option<String>, Option<String>)>,
/* private fields */
}Expand description
Hysteresis controller for dynamic routing.
Fields§
§skills: Vec<RoutableSkill>§e_on: f32Nucleation threshold: activate below this E.
e_off: f32Abandon threshold: drop the active skill above this E (> e_on).
margin: f32A rival must beat the active skill by this margin to steal it.
period: usizeRe-route every period tokens (dispatch amortization; 1 = every).
switches: Vec<(usize, Option<String>, Option<String>)>Switch log for demo/telemetry: (token#, from_id, to_id).
Implementations§
Source§impl DynRouter
impl DynRouter
pub fn new(skills: Vec<RoutableSkill>) -> Self
Sourcepub fn phi_layer(&self) -> Option<usize>
pub fn phi_layer(&self) -> Option<usize>
The single phi_layer to capture (skills share it in the swarm; if they differ, the first is used and a warning is the caller’s).
Sourcepub fn step(&mut self, phi: &[f32], token_no: usize) -> Option<Option<usize>>
pub fn step(&mut self, phi: &[f32], token_no: usize) -> Option<Option<usize>>
Decide the active skill for the next window given the current φ.
Returns Some(new_active) when a switch is warranted (caller calls
pipeline.set_active_skill), else None (unchanged). token_no is
only for the switch log.
pub fn active(&self) -> Option<usize>
Sourcepub fn active_id(&self) -> Option<String>
pub fn active_id(&self) -> Option<String>
Id of the currently active skill (telemetry), None = backbone.
Sourcepub fn last_best_e(&self) -> f32
pub fn last_best_e(&self) -> f32
Min recon error E at the last evaluation (telemetry coherence).