morphology (macula_tweann v0.11.3)

View Source

Morphology module for sensor/actuator specifications.

This module provides the interface for accessing morphologies (problem domains). Morphologies are now registered at runtime via morphology_registry.

Using Morphologies:

1. Register a morphology (typically at application startup):

morphology_registry:register(xor_mimic, morphology_xor).

2. Use the morphology in agent construction:

Constraint = #constraint{morphology = xor_mimic}, {ok, AgentId} = genotype:construct_agent(Constraint).

Custom Morphologies:

To create a custom morphology: 1. Implement morphology_behaviour in your module 2. Register it at runtime 3. Use it in constraints

See guides/CUSTOM_MORPHOLOGIES.md for detailed instructions. See examples/ directory for reference implementations.

Based on DXNN2 by Gene Sher ("Handbook of Neuroevolution through Erlang").

Summary

Functions

Get all actuators for a morphology.

Get initial actuators for a morphology.

Get initial sensors for a morphology.

Get all sensors for a morphology.

Functions

get_Actuators(Morphology)

-spec get_Actuators(atom() | {module(), 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()}].

Get all actuators for a morphology.

Looks up the morphology in the registry and calls its get_actuators/1 callback.

get_InitActuators(Morphology)

-spec get_InitActuators(atom() | {module(), 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()}].

Get initial actuators for a morphology.

Returns the first actuator from the morphology's actuator list. Used when constructing a new agent to get the default actuator.

get_InitSensors(Morphology)

-spec get_InitSensors(atom() | {module(), 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()}].

Get initial sensors for a morphology.

Returns the first sensor from the morphology's sensor list. Used when constructing a new agent to get the default sensor.

get_Sensors(Morphology)

-spec get_Sensors(atom() | {module(), 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()}].

Get all sensors for a morphology.

Looks up the morphology in the registry and calls its get_sensors/1 callback.