Bardo.AgentManager.Actuator behaviour (Bardo v0.1.0)

View Source

Defines generic actuator behavior.

An actuator is a process that accepts signals from neurons in the output layer, orders them into a vector, and then uses this vector to control some function that acts on the environment or the NN itself. An actuator might have incoming connections from multiple neurons, in which case it would wait until all neurons have sent their output signals, accumulate these signals into a vector, and then use this vector as a parameter to its actuation function.

The order in which the signals are accumulated into a vector is the same order as the neuron ids are stored. Once all signals have been gathered, the actuator executes its function, waits for its fitness score from the scape, sends the cortex the sync signal, and then again begins to wait for neural signals.

Summary

Callbacks

Callback to actuate based on received signals.

Callback to initialize the actuator module state.

Optional callback for cleanup when terminating.

Functions

The fitness score from the scape after the actuator has performed an action.

Send output from neural network to actuator. For use in tests.

Initializes the actuator process.

Main loop to handle initialization message.

Loop that handles actuator operations after initialization.

Spawns an Actuator process belonging to the exoself process that spawned it and calls init to initialize.

Terminates the actuator.

Terminates the actuator process with the given reason.

Callbacks

actuate(atom, {})

@callback actuate(
  atom(),
  {agent_id :: tuple(), output :: [float()], params :: any(),
   vl :: non_neg_integer(), scape :: pid() | atom(),
   actuator :: pid() | tuple(), mod_state :: any()}
) :: any()

Callback to actuate based on received signals.

init(list)

@callback init(list()) :: {:ok, any()}

Callback to initialize the actuator module state.

terminate(reason, mod_state)

(optional)
@callback terminate(reason :: atom(), mod_state :: any()) :: :ok

Optional callback for cleanup when terminating.

Functions

fitness(actuator_pid, arg)

@spec fitness(
  pid(),
  {[float()], integer() | atom()}
) :: :ok

The fitness score from the scape after the actuator has performed an action.

forward(actuator_pid, from_pid, output)

@spec forward(pid(), pid(), [float()]) :: :ok

Send output from neural network to actuator. For use in tests.

init(exoself_pid)

@spec init(pid()) :: no_return()

Initializes the actuator process.

init_phase2(pid, exoself_pid, id, agent_id, cx_pid, scape, a_name, vl, params, fanin_pids, op_mode)

@spec init_phase2(
  pid(),
  pid(),
  tuple(),
  tuple(),
  pid(),
  pid(),
  {atom(), atom()},
  integer(),
  any(),
  [pid()],
  atom()
) :: :ok

Initializes the actuator setting it to its initial state.

loop(exoself_pid)

@spec loop(pid()) :: no_return()

Main loop to handle initialization message.

loop(state, exoself_pid, cx_pid, arg, acc, op_mode)

Loop that handles actuator operations after initialization.

start(node, exoself_pid)

@spec start(node(), pid()) :: pid()

Spawns an Actuator process belonging to the exoself process that spawned it and calls init to initialize.

stop(pid, exoself_pid)

@spec stop(pid(), pid()) :: :ok

Terminates the actuator.

terminate(reason, state)

@spec terminate(atom(), map()) :: no_return()

Terminates the actuator process with the given reason.