agent_evaluator behaviour (faber_neuroevolution v1.2.4)

View Source

See also: agent_bridge, agent_environment.

Summary

Types

Unique identifier for the evaluator. Examples: <<"hex_arena_fitness">>, <<"foraging_score">>.

Scalar fitness score. Higher is better. Should be non-negative for compatibility with selection algorithms.

Breakdown of fitness into named components. Useful for analysis and debugging.

Performance metrics from a completed episode. See agent_environment:metrics().

Types

evaluator_name/0

-type evaluator_name() :: binary().

Unique identifier for the evaluator. Examples: <<"hex_arena_fitness">>, <<"foraging_score">>.

fitness/0

-type fitness() :: float().

Scalar fitness score. Higher is better. Should be non-negative for compatibility with selection algorithms.

fitness_components/0

-type fitness_components() :: #{atom() => float()}.

Breakdown of fitness into named components. Useful for analysis and debugging.

metrics/0

-type metrics() :: map().

Performance metrics from a completed episode. See agent_environment:metrics().

Callbacks

calculate_fitness/1

-callback calculate_fitness(Metrics) -> Fitness when Metrics :: metrics(), Fitness :: fitness().

fitness_components/1

(optional)
-callback fitness_components(Metrics) -> Components
                                when Metrics :: metrics(), Components :: fitness_components().

name/0

-callback name() -> evaluator_name().

Functions

evaluate(Module, Metrics)

-spec evaluate(Module, Metrics) -> {ok, Fitness} | {error, Reason}
                  when Module :: module(), Metrics :: metrics(), Fitness :: fitness(), Reason :: term().

evaluate_with_breakdown(Module, Metrics)

-spec evaluate_with_breakdown(Module, Metrics) -> {ok, Fitness, Components} | {error, Reason}
                                 when
                                     Module :: module(),
                                     Metrics :: metrics(),
                                     Fitness :: fitness(),
                                     Components :: fitness_components(),
                                     Reason :: term().

get_info(Module)

-spec get_info(Module) -> {ok, Info} | {error, Reason}
                  when
                      Module :: module(),
                      Info :: #{name := evaluator_name(), has_components := boolean()},
                      Reason :: term().

validate(Module)

-spec validate(Module) -> ok | {error, [Reason]} when Module :: module(), Reason :: term().