morphology_behaviour behaviour (macula_tweann v0.18.1)
View SourceBehaviour for implementing morphologies (sensor/actuator specifications).
A morphology defines the I/O interface between a neural network and its environment. Applications implement this behaviour to create custom morphologies without modifying the macula-tweann library.
Example Implementation:
-module(my_morphology). -behaviour(morphology_behaviour).
-export([get_sensors/1, get_actuators/1]). -include("records.hrl").
get_sensors(my_problem) -> [#sensor{name = my_sensor, vl = 3, ...}]; get_sensors(_) -> error(invalid_morphology).
get_actuators(my_problem) -> [#actuator{name = my_actuator, vl = 2, ...}]; get_actuators(_) -> error(invalid_morphology).
Then register at runtime:
morphology_registry:register(my_problem, my_morphology).
Summary
Callbacks
-callback get_actuators(MorphologyName :: atom()) -> [#actuator{id :: term(), name :: term(), type :: term(), cx_id :: term(), scape :: term(), vl :: term(), fanin_ids :: term(), generation :: term(), format :: term(), parameters :: term(), gt_parameters :: term(), phys_rep :: term(), vis_rep :: term(), pre_f :: term(), post_f :: term(), innovation :: term()}].
-callback get_sensors(MorphologyName :: atom()) -> [#sensor{id :: term(), name :: term(), type :: term(), cx_id :: term(), scape :: term(), vl :: term(), fanout_ids :: term(), generation :: term(), format :: term(), parameters :: term(), gt_parameters :: term(), phys_rep :: term(), vis_rep :: term(), pre_f :: term(), post_f :: term(), innovation :: term()}].