exoself (macula_tweann v0.15.2)

View Source

Exoself - Neural network lifecycle manager

The exoself is responsible for spawning, linking, and managing the lifecycle of a neural network phenotype from its genotype. It handles:

- Spawning all network processes (sensors, neurons, actuators, cortex) - Linking processes with their inputs and outputs - Weight tuning with simulated annealing - Network backup and restoration - Fitness evaluation coordination

Lifecycle

1. prep/3 - Initialize state and spawn network 2. loop/1 - Handle tuning cycles and evaluation 3. Terminate - Clean up network processes

Tuning Algorithm

The exoself uses memetic weight tuning with simulated annealing: 1. Perturb subset of weights 2. Evaluate network fitness 3. If better: keep changes, update best 4. If worse: restore previous weights 5. Reduce perturbation over attempts (annealing)

Summary

Functions

Calculate perturbation for current attempt using annealing.

Initialize the exoself and spawn the network.

Prepare and start the network (called by spawned process).

Start an exoself process for an agent.

Functions

calculate_perturbation(InitialRange, Attempt, MaxAttempts, AnnealingParam)

-spec calculate_perturbation(float(), pos_integer(), pos_integer(), float()) -> float().

Calculate perturbation for current attempt using annealing.

Exported for testing.

init(CallerPid, AgentId, PopMonitorPid, OpMode)

-spec init(pid() | undefined, term(), pid() | undefined, gt | validation | test) -> no_return().

Initialize the exoself and spawn the network.

prep(AgentId, PopMonitorPid, OpMode)

-spec prep(term(), pid() | undefined, gt | validation | test) -> no_return().

Prepare and start the network (called by spawned process).

start(AgentId, PopMonitorPid, OpMode)

-spec start(term(), pid() | undefined, gt | validation | test) -> {ok, pid()}.

Start an exoself process for an agent.

Spawns an exoself that will construct and manage the phenotype for the given agent.