controller_events (faber_neuroevolution v1.2.4)
View SourceController Event Publishing for Liquid Conglomerate.
Part of the Liquid Conglomerate v2 event-driven architecture. This module provides topic definitions and publishing helpers for L0/L1/L2 controller chain communication.
Event-Driven Controller Chain
Instead of direct function calls between controller levels, each level publishes events to topics. Higher levels subscribe and react.
Topic Hierarchy
controller.reward - Reward signals for learning controller.SILO.l0.metrics - L0 performance metrics controller.SILO.l1.metrics - L1 performance metrics controller.SILO.l2.guidance - L2 strategic guidance controller.population.metrics - Population-level metrics
Data Flow (Event-Driven)
1. Evolution engine publishes controller.reward with reward signal 2. L0 publishes controller.SILO.l0.metrics after each update 3. L1 subscribes to L0 metrics, publishes controller.SILO.l1.metrics 4. L2 subscribes to L1 metrics, publishes controller.SILO.l2.guidance 5. L0/L1 subscribe to guidance to adjust their behavior
Summary
Functions
Get the L0 metrics topic for a silo.
Get the L1 metrics topic for a silo.
Get the L2 guidance topic for a silo.
Get the population metrics topic.
Publish L0 controller metrics.
Publish L1 controller metrics.
Publish L2 strategic guidance.
Publish population-level metrics.
Publish a reward signal for controller learning.
Get the reward signal topic.
Subscribe to L0 metrics for a specific silo.
Subscribe a specific process to L0 metrics for a silo.
Subscribe to L1 metrics for a specific silo.
Subscribe a specific process to L1 metrics for a silo.
Subscribe to L2 guidance for a specific silo.
Subscribe a specific process to L2 guidance for a silo.
Subscribe to population-level metrics.
Subscribe a specific process to population-level metrics.
Subscribe the calling process to reward signals.
Subscribe a specific process to reward signals.
Types
Functions
Get the L0 metrics topic for a silo.
Get the L1 metrics topic for a silo.
Get the L2 guidance topic for a silo.
-spec population_metrics_topic() -> binary().
Get the population metrics topic.
Publish L0 controller metrics.
Called by L0 after each update cycle to report performance. L1 subscribes to adjust its hyperparameter deltas.
Metrics typically include: - reward: Recent reward signal - hyperparameters: Current L0 output values - update_count: Number of L0 updates
Publish L1 controller metrics.
Called by L1 after processing L0 metrics. L2 subscribes to adjust its strategic parameters.
Metrics typically include: - cumulative_reward: Sum of L0 rewards over L1 window - hyperparameter_deltas: Current L1 output values - observations: Number of L0 observations
Publish L2 strategic guidance.
Called by L2 to provide guidance to L1 and L0.
Guidance typically includes: - l1_hyperparameters: Hyperparameters for L1 controller - exploration_rate: How much L1 should explore - adaptation_speed: How fast L1 should adapt
-spec publish_population_metrics(map()) -> ok.
Publish population-level metrics.
Called by lc_population after processing training metrics.
Metrics typically include: - generation: Current generation number - active_agent: Currently active controller - fitness_scores: All agent fitness scores - trial_progress: Progress through current trial
Publish a reward signal for controller learning.
This replaces imperative calls like: - lc_chain:train(ChainPid, Reward) - lc_silo_chain:report_reward(Chain, Reward)
Event format (map with keys): event_type - binary "reward_signal" timestamp - millisecond timestamp silo - silo name atom reward - float reward value source - caller module atom
-spec reward_topic() -> binary().
Get the reward signal topic.
-spec subscribe_to_l0_metrics(silo_name()) -> ok.
Subscribe to L0 metrics for a specific silo.
Subscribe a specific process to L0 metrics for a silo.
-spec subscribe_to_l1_metrics(silo_name()) -> ok.
Subscribe to L1 metrics for a specific silo.
Subscribe a specific process to L1 metrics for a silo.
-spec subscribe_to_l2_guidance(silo_name()) -> ok.
Subscribe to L2 guidance for a specific silo.
Subscribe a specific process to L2 guidance for a silo.
-spec subscribe_to_population_metrics() -> ok.
Subscribe to population-level metrics.
-spec subscribe_to_population_metrics(pid()) -> ok.
Subscribe a specific process to population-level metrics.
-spec subscribe_to_reward() -> ok.
Subscribe the calling process to reward signals.
-spec subscribe_to_reward(pid()) -> ok.
Subscribe a specific process to reward signals.