agent_actuator behaviour (macula_neuroevolution v0.28.0)

View Source

See also: agent_bridge, agent_definition, agent_sensor.

Summary

Types

Action command produced by the actuator. Structure is domain-defined, typically includes: #{type => atom(), ...action_specific_fields}.

Unique identifier for the actuator type within an agent. Examples: <<"movement">>, <<"signal">>, <<"eat">>.

Agent-specific state. See agent_sensor:agent_state().

Environment state. See agent_sensor:env_state().

Number of neural network output nodes this actuator consumes. Must be positive (at least 1 output).

List of neural network outputs to interpret. Length must match output_count/0.

Types

action/0

-type action() :: map().

Action command produced by the actuator. Structure is domain-defined, typically includes: #{type => atom(), ...action_specific_fields}.

actuator_name/0

-type actuator_name() :: binary().

Unique identifier for the actuator type within an agent. Examples: <<"movement">>, <<"signal">>, <<"eat">>.

agent_state/0

-type agent_state() :: map().

Agent-specific state. See agent_sensor:agent_state().

env_state/0

-type env_state() :: map().

Environment state. See agent_sensor:env_state().

output_count/0

-type output_count() :: pos_integer().

Number of neural network output nodes this actuator consumes. Must be positive (at least 1 output).

output_values/0

-type output_values() :: [float()].

List of neural network outputs to interpret. Length must match output_count/0.

Callbacks

act/3

-callback act(Outputs, AgentState, EnvState) -> {ok, Action} | {error, Reason}
                 when
                     Outputs :: output_values(),
                     AgentState :: agent_state(),
                     EnvState :: env_state(),
                     Action :: action(),
                     Reason :: term().

name/0

-callback name() -> actuator_name().

output_count/0

-callback output_count() -> output_count().

Functions

get_info(Module)

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

validate(Module)

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

validate_outputs(Module, Outputs)

-spec validate_outputs(Module, Outputs) -> ok | {error, Reason}
                          when Module :: module(), Outputs :: output_values(), Reason :: term().