constructor (macula_tweann v0.18.1)
View SourcePhenotype constructor for TWEANN networks.
This module converts genotypes (genetic descriptions) into phenotypes (running neural network processes). It spawns sensor, neuron, actuator, and cortex processes based on the genotype specification.
Based on DXNN2 by Gene Sher ("Handbook of Neuroevolution through Erlang").
Construction Process
1. Read agent genotype from Mnesia database 2. Spawn all sensors, neurons, and actuators 3. Build PID mappings from genotype IDs to process PIDs 4. Spawn cortex to coordinate the network 5. Return phenotype record with all PIDs
Phenotype Record
The phenotype is a map containing: - agent_id: Original agent ID - cortex_pid: PID of the cortex process - sensor_pids: List of sensor PIDs - neuron_pids: List of neuron PIDs - actuator_pids: List of actuator PIDs - id_to_pid: Map from genotype IDs to PIDs
Summary
Functions
Construct a phenotype from an agent genotype.
Construct a phenotype with options.
Terminate a phenotype (stop all processes).
Functions
-spec construct(term()) -> #{agent_id := term(), cortex_pid := pid(), sensor_pids := [pid()], neuron_pids := [pid()], actuator_pids := [pid()], id_to_pid := map()}.
Construct a phenotype from an agent genotype.
Spawns all neural network processes and returns a phenotype record.
-spec construct(term(), map()) -> #{agent_id := term(), cortex_pid := pid(), sensor_pids := [pid()], neuron_pids := [pid()], actuator_pids := [pid()], id_to_pid := map()}.
Construct a phenotype with options.
Options: - exoself_pid: PID to receive cortex messages (default: self()) - scape_pid: PID of the environment/scape (default: undefined)
-spec terminate(map()) -> ok.
Terminate a phenotype (stop all processes).
Sends terminate signal to the cortex, which terminates all components.