meta_config (macula_neuroevolution v0.28.0)

View Source

Configuration builder for the LTC meta-controller.

This module provides helper functions to construct #meta_config{} records from maps, enabling clean integration with Elixir applications.

Usage

From Elixir: meta_config = :meta_config.from_map(%{ network_topology: {11, [24, 16, 8], 5}, neuron_type: :cfc, time_constant: 50.0 }) neuro_config = :neuro_config.from_map(%{ meta_controller_config: meta_config, ... })

Summary

Functions

Create a default configuration with sensible defaults.

Default parameter bounds for meta-controller outputs.

Default reward component weights.

Build a #meta_config{} record from a map.

Convert a #meta_config{} record to a map.

Types

meta_param/0

-type meta_param() ::
          mutation_rate | mutation_strength | selection_ratio | evaluations_per_individual |
          max_concurrent_evaluations | population_size | add_node_rate | add_connection_rate |
          complexity_penalty.

reward_component/0

-type reward_component() ::
          convergence_speed | final_fitness | efficiency_ratio | diversity_aware | normative_structure.

Functions

default()

-spec default() ->
                 #meta_config{network_topology :: {pos_integer(), [pos_integer()], pos_integer()},
                              neuron_type :: ltc | cfc,
                              time_constant :: float(),
                              state_bound :: float(),
                              reward_weights :: #{reward_component() => float()},
                              learning_rate :: float(),
                              param_bounds :: #{meta_param() => {float(), float()}},
                              control_population_size :: boolean(),
                              control_topology :: boolean(),
                              history_window :: pos_integer(),
                              momentum :: float()}.

Create a default configuration with sensible defaults.

default_param_bounds()

-spec default_param_bounds() -> map().

Default parameter bounds for meta-controller outputs.

These bounds define the legal ranges for each hyperparameter that the LTC meta-controller can adjust.

Includes resource-aware parameters: - evaluations_per_individual: Can drop to 1 under memory pressure - max_concurrent_evaluations: Limits parallelism under load

default_reward_weights()

-spec default_reward_weights() -> map().

Default reward component weights.

These weights balance different aspects of training quality: - convergence_speed: How quickly fitness improves - final_fitness: The ultimate fitness achieved - efficiency_ratio: Fitness improvement per evaluation - diversity_aware: Maintaining population diversity - normative_structure: Preserving adaptation potential

from_map(Map)

-spec from_map(map()) ->
                  #meta_config{network_topology :: {pos_integer(), [pos_integer()], pos_integer()},
                               neuron_type :: ltc | cfc,
                               time_constant :: float(),
                               state_bound :: float(),
                               reward_weights :: #{reward_component() => float()},
                               learning_rate :: float(),
                               param_bounds :: #{meta_param() => {float(), float()}},
                               control_population_size :: boolean(),
                               control_topology :: boolean(),
                               history_window :: pos_integer(),
                               momentum :: float()}.

Build a #meta_config{} record from a map.

All fields are optional - missing fields use sensible defaults. This function handles type coercion and validation.

to_map(Meta_config)

-spec to_map(#meta_config{network_topology :: {pos_integer(), [pos_integer()], pos_integer()},
                          neuron_type :: ltc | cfc,
                          time_constant :: float(),
                          state_bound :: float(),
                          reward_weights :: #{reward_component() => float()},
                          learning_rate :: float(),
                          param_bounds :: #{meta_param() => {float(), float()}},
                          control_population_size :: boolean(),
                          control_topology :: boolean(),
                          history_window :: pos_integer(),
                          momentum :: float()}) ->
                map().

Convert a #meta_config{} record to a map.

Useful for serialization, logging, and passing to Elixir code.