lc_silo_behavior behaviour (faber_neuroevolution v1.2.4)
View SourceCommon behavior module for Liquid Conglomerate Silos.
All 13 silos implement this common pattern derived from task_silo.erl: gen_server behavior L0/L1/L2 hierarchical control levels Evaluation-centric tracking (total_evaluations as primary dimension) Velocity-based stagnation detection Cross-silo signal integration via lc_cross_silo ETS tables for persistent collections (where needed)
Implementing a New Silo
1. Create module with -behaviour(lc_silo_behavior) 2. Include lc_silos.hrl for common records 3. Implement required callbacks: init_silo/1: Initialize silo-specific state collect_sensors/1: Gather L0 sensor values apply_actuators/2: Apply L0 actuator outputs compute_reward/1: Compute reward for LC learning
Summary
Functions
Apply asymmetric EMA smoothing for fast escalation, slow de-escalation.
Clamp a value to a specified range.
Compute stagnation severity from velocity.
Compute improvement velocity from checkpoints.
Apply exponential moving average smoothing.
Normalize a value to [0,1] range given min/max bounds.
Callbacks
Functions
-spec asymmetric_ema_smooth(NewValue :: float(), PreviousValue :: float(), BaseMomentum :: float(), EscalationFactor :: float(), DeescalationOffset :: float()) -> float().
Apply asymmetric EMA smoothing for fast escalation, slow de-escalation.
When escalating (new value higher): use low momentum (fast response) When de-escalating (new value lower): use high momentum (slow recovery)
This prevents oscillation while ensuring responsive intervention.
Clamp a value to a specified range.
Compute stagnation severity from velocity.
Severity = clamp((threshold - avg_velocity) / threshold, 0.0, 1.0)
Returns 0.0 = healthy, 1.0 = critical stagnation.
-spec compute_velocity(CurrentFitness :: float(), CurrentEvals :: non_neg_integer(), PrevFitness :: float(), PrevEvals :: non_neg_integer()) -> float().
Compute improvement velocity from checkpoints.
Velocity = (delta_fitness / delta_evaluations) * 1000
Returns velocity in fitness improvement per 1000 evaluations.
Apply exponential moving average smoothing.
SmoothedValue = Momentum * PreviousValue + (1 - Momentum) * NewValue
Higher momentum = smoother but slower response.
Normalize a value to [0,1] range given min/max bounds.