bridge_evaluator (faber_neuroevolution v1.2.4)
View SourceBridge Evaluator - Adapts Agent SDK to neuroevolution_evaluator behaviour.
This module bridges the Agent SDK's agent_bridge with the neuroevolution system's evaluator interface. It allows agent_trainer to use agent_bridge configurations with neuroevolution_server.
Usage
This module is used internally by agent_trainer. You don't need to use it directly. Configure your training via agent_trainer:train/2.
How It Works
1. agent_trainer stores the validated bridge in evaluator_options 2. This module extracts the bridge and env_config from options 3. For each individual, it extracts the network and runs an episode 4. Returns the individual with populated metrics and fitness
See also: agent_trainer, neuroevolution_evaluator.
Summary
Functions
Calculates fitness from metrics (not used - fitness comes from bridge).
Evaluates an individual using the agent bridge.
Types
-type fitness() :: float() | undefined.
-type generation() :: non_neg_integer().
-type genome() :: #genome{connection_genes :: [#connection_gene{innovation :: pos_integer() | undefined, from_id :: term(), to_id :: term(), weight :: float(), enabled :: boolean()}], input_count :: non_neg_integer(), hidden_count :: non_neg_integer(), output_count :: non_neg_integer()}.
-type individual() :: #individual{id :: individual_id(), network :: network(), genome :: genome() | undefined, parent1_id :: individual_id() | undefined, parent2_id :: individual_id() | undefined, fitness :: fitness(), metrics :: metrics(), generation_born :: generation(), birth_evaluation :: non_neg_integer(), max_age :: pos_integer(), is_survivor :: boolean(), is_offspring :: boolean()}.
-type individual_id() :: term().
-type metrics() :: map().
-type network() :: term().
Functions
Calculates fitness from metrics (not used - fitness comes from bridge).
This is a fallback in case the neuroevolution server calls it directly. Normally, fitness is calculated by agent_evaluator via the bridge.
-spec evaluate(Individual, Options) -> {ok, Individual} | {error, term()} when Individual :: individual(), Options :: map().
Evaluates an individual using the agent bridge.
Extracts the network from the individual, runs it through the bridge's sense-think-act cycle, and returns the individual with metrics populated.