agent_species behaviour (faber_neuroevolution v1.2.4)
View SourceAgent Species Behaviour - Defines a species/culture of agents.
This behaviour extends agent_definition to support multi-species coevolution. Each species has its own network topology, sensors, actuators, and fitness function.
Overview
Species represent distinct agent types that coevolve in a shared environment. Examples:
- Foragers - Optimized for finding and consuming food
- Predators - Optimized for hunting other agents
- Scavengers - Optimized for following and opportunistic feeding
Two-Level Speciation
Level 1: EXPLICIT SPECIES (user-defined)
- Different network topologies
- Different sensors/actuators
- Different fitness functions
Level 2: BEHAVIORAL SUB-SPECIES (emergent)
- Same topology, different behaviors
- Identified via behavioral fingerprinting
- Preserves diversity within species
```
== Example Implementation ==
```
-module(forager_species).
-behaviour(agent_species).
name() -> <<"forager">>.
network_topology() -> {29, [32, 16], 9}.
sensors() -> [vision_sensor, smell_sensor, state_sensor].
actuators() -> [movement_actuator, signal_actuator].
evaluator() -> forager_evaluator.
spawn_config() -> #{energy => 150, spawn_zone => center}.
subspeciation_threshold() -> 1.5.See also: species_registry.
Summary
Functions
Converts species to bridge config for single-species training.
Extracts species configuration from a module.
Validates that a module correctly implements agent_species.
Types
-type species_config() :: #{name := binary(), topology := {pos_integer(), [pos_integer()], pos_integer()}, sensors := [module()], actuators := [module()], evaluator := module(), spawn_config := map(), subspeciation_threshold := float() | infinity, mutation_config => map()}.
-type subspecies_id() :: {species_id(), non_neg_integer()}.
Callbacks
-callback actuators() -> [module()].
-callback evaluator() -> module().
-callback mutation_config() -> map().
-callback name() -> binary().
-callback network_topology() -> {pos_integer(), [pos_integer()], pos_integer()}.
-callback sensors() -> [module()].
-callback spawn_config() -> map().
-callback subspeciation_threshold() -> float() | infinity.
-callback version() -> binary().
Functions
-spec to_bridge_config(Module, Environment) -> agent_bridge:bridge_config() when Module :: module(), Environment :: module().
Converts species to bridge config for single-species training.
-spec to_config(Module) -> species_config() when Module :: module().
Extracts species configuration from a module.
Validates that a module correctly implements agent_species.