Skip to main content

RouterConfig

Struct RouterConfig 

Source
pub struct RouterConfig {
    pub channel_count: usize,
    pub self_weight: f32,
    pub cross_weight: f32,
    pub threshold: f32,
    pub leak: f32,
    pub routing_timesteps: usize,
    pub min_fire_rate: f32,
    pub plasticity_decay: f32,
    pub plasticity_potentiate: f32,
    pub plasticity_speed: f32,
    pub fatigue_accumulation: f32,
    pub fatigue_recovery: f32,
}
Expand description

Configuration for a generic channel router.

Direct struct literals can hold out-of-range values; they are rejected by RouterConfig::validate, ChannelRouter::try_with_config, and by deserialization of both this type and ChannelRouter.

§Valid ranges

FieldConstraint
channel_count1..=MAX_ROUTER_CHANNELS
routing_timesteps1..=MAX_ROUTING_TIMESTEPS
self_weight, cross_weight, thresholdfinite; signed weights are allowed
leak, min_fire_rate, plasticity_decay, plasticity_speed, fatigue_accumulation, fatigue_recoveryfinite, in 0.0..=1.0
plasticity_potentiatefinite, >= 0 (scale factor, not a probability)

cross_weight is typically negative (lateral inhibition). That sign is allowed and intended; it is not required. Positive self-weights are the usual self-affinity pattern, but a signed self-weight is also accepted.

Fields§

§channel_count: usize

Number of input/output channels (1..=MAX_ROUTER_CHANNELS).

§self_weight: f32

Self-affinity weight (diagonal of the dense channel matrix).

Must be finite. Signed values are allowed.

§cross_weight: f32

Cross-channel weight (off-diagonal).

Must be finite. Signed values are allowed; negative values are the intended lateral-inhibition pattern and are not rejected.

§threshold: f32

Firing threshold for neuromodulatory neurons.

Must be finite. Typically positive; zero and negative values are accepted here (modulated routing later clamps the effective threshold).

§leak: f32

Passive leak rate per timestep.

Fraction of (V − V_rest) removed each tick. Valid range: 0.0..=1.0. 0.0 = no leak; 1.0 = membrane snaps to rest in one tick.

§routing_timesteps: usize

Integration timesteps per routing decision.

Must be in 1..=MAX_ROUTING_TIMESTEPS. More timesteps → more stable firing-rate estimates.

§min_fire_rate: f32

Minimum firing rate to activate a channel.

Fraction of routing_timesteps that must spike. Valid range: 0.0..=1.0.

§plasticity_decay: f32

Weight decay rate for inactive channels (use-it-or-lose-it).

Mix toward baseline: current + (baseline − current) * decay. Valid range: 0.0..=1.0.

§plasticity_potentiate: f32

Weight potentiation rate for active channels (dopamine-gated).

Non-negative finite scale factor, not a probability. The amplified target is baseline * (1 + potentiate * (1 + dopamine)).

§plasticity_speed: f32

Smoothing factor for active-channel weight potentiation (0.0 = no change, 1.0 = snap to amplified target). Tunable so callers can trade off adaptation speed vs. numerical stability. Valid range: 0.0..=1.0.

§fatigue_accumulation: f32

Fatigue accumulation per activation.

Added to per-channel fatigue (itself in 0.0..=1.0). Valid range: 0.0..=1.0.

§fatigue_recovery: f32

Fatigue recovery per idle routing decision.

Subtracted from per-channel fatigue. Valid range: 0.0..=1.0.

Implementations§

Source§

impl RouterConfig

Source

pub fn validate(&self) -> Result<()>

Check that every field is in its documented range.

This is the single validation path used by ChannelRouter::try_with_config, ChannelRouter::with_config, and by Deserialize for both RouterConfig and ChannelRouter. It does not allocate.

Trait Implementations§

Source§

impl Clone for RouterConfig

Source§

fn clone(&self) -> RouterConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RouterConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RouterConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RouterConfig

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RouterConfig

Source§

fn eq(&self, other: &RouterConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RouterConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RouterConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.