agent_definition behaviour (macula_neuroevolution v0.28.0)

View Source

See also: agent_actuator, agent_bridge, agent_sensor.

Summary

Types

Unique identifier for the agent type. Should be a descriptive name like <<"hex_arena_agent">>.

Semantic version string, e.g., <<"1.0.0">>.

Neural network shape specification: {Inputs, HiddenLayers, Outputs}.

Types

agent_name/0

-type agent_name() :: binary().

Unique identifier for the agent type. Should be a descriptive name like <<"hex_arena_agent">>.

agent_version/0

-type agent_version() :: binary().

Semantic version string, e.g., <<"1.0.0">>.

network_topology/0

-type network_topology() :: {pos_integer(), [pos_integer()], pos_integer()}.

Neural network shape specification: {Inputs, HiddenLayers, Outputs}.

  • Inputs - Total input count, must match sum of all sensor input counts
  • HiddenLayers - List of hidden layer sizes (can be empty for direct connections)
  • Outputs - Total output count, must match sum of all actuator output counts

Callbacks

name/0

-callback name() -> agent_name().

network_topology/0

-callback network_topology() -> network_topology().

version/0

-callback version() -> agent_version().

Functions

get_info(Module)

-spec get_info(Module) -> {ok, Info} | {error, Reason}
                  when
                      Module :: module(),
                      Info ::
                          #{name := agent_name(),
                            version := agent_version(),
                            topology := network_topology(),
                            inputs := pos_integer(),
                            hidden_layers := [pos_integer()],
                            outputs := pos_integer()},
                      Reason :: term().

validate(Module)

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