lc_chain (faber_neuroevolution v1.2.4)
View SourceChained LTC Controller for Liquid Conglomerate.
This gen_server manages the L2→L1→L0 chain of LTC TWEANN networks. Each level is a separate neural network that learns at different timescales.
Architecture
L2 (Strategic, τ=100): Inputs: Evolution metrics (fitness, stagnation, diversity) Outputs: 4 strategic signals → L1 inputs
L1 (Tactical, τ=50): Inputs: L2's 4 outputs Outputs: 5 tactical signals → L0 inputs
L0 (Reactive, τ=10): Inputs: L1's 5 outputs + emergent metrics (evolvable sensors) Outputs: Final hyperparameters
Usage
%% Start the chain {ok, Pid} = lc_chain:start_link(Config),
%% Forward pass: compute hyperparameters EvoMetrics = #evolution_metrics{best_fitness = 0.85, ...}, EmergentMetrics = #emergent_metrics{convergence_rate = 0.02, ...}, Hyperparams = lc_chain:forward(Pid, EvoMetrics, EmergentMetrics),
%% Train: provide reward signal lc_chain:train(Pid, Reward).
Summary
Functions
Forward pass with only evolution metrics.
Forward pass through the chain.
Get last computed hyperparameters.
Get current chain state (for debugging/visualization).
Reset the chain state.
Start the LC chain with default configuration.
Start the LC chain with custom configuration.
Train the chain with a reward signal.
Types
-type emergent_metrics() :: #emergent_metrics{convergence_rate :: float(), fitness_plateau_duration :: non_neg_integer(), current_mutation_rate :: float(), current_selection_ratio :: float(), survival_rate :: float(), offspring_rate :: float(), elite_age :: non_neg_integer(), complexity_trend :: float(), avg_network_size :: float(), species_extinction_rate :: float(), species_creation_rate :: float(), innovation_rate :: float(), diversity_index :: float()}.
-type evolution_metrics() :: #evolution_metrics{best_fitness :: float(), avg_fitness :: float(), fitness_improvement :: float(), fitness_variance :: float(), stagnation_counter :: non_neg_integer(), generation_progress :: float(), population_diversity :: float(), species_count :: pos_integer()}.
-type lc_chain_config() :: #lc_chain_config{l2_tau :: float(), l1_tau :: float(), l0_tau :: float(), learning_rate :: float(), evolve_topology :: boolean(), l2_hidden_layers :: [pos_integer()], l1_hidden_layers :: [pos_integer()], l0_hidden_layers :: [pos_integer()], activation :: tanh | sigmoid | relu, gamma :: float()}.
Functions
-spec forward(pid() | atom(), evolution_metrics()) -> lc_hyperparams().
Forward pass with only evolution metrics.
Uses default emergent metrics.
-spec forward(pid() | atom(), evolution_metrics(), emergent_metrics()) -> lc_hyperparams().
Forward pass through the chain.
Computes hyperparameters by cascading through L2→L1→L0.
-spec get_hyperparams(pid() | atom()) -> lc_hyperparams().
Get last computed hyperparameters.
Get current chain state (for debugging/visualization).
Reset the chain state.
Start the LC chain with default configuration.
-spec start_link(lc_chain_config()) -> {ok, pid()} | {error, term()}.
Start the LC chain with custom configuration.
Train the chain with a reward signal.
Backpropagates reward through all three levels.