topological_mutations (faber_tweann v2.4.0)

View Source

Topological mutation operators for neural network evolution.

This module provides mutations that modify network structure: - add_neuron: Insert neuron into existing connection - add_outlink: Add output connection from neuron - add_inlink: Add input connection to neuron - add_sensorlink: Connect sensor to neuron - add_actuatorlink: Connect neuron to actuator - outsplice: Split output connection with new neuron - add_bias: Add bias connection to neuron

Summary

Functions

Add a new actuator to the network.

Add link from a neuron to an actuator.

Add bias input to a random neuron.

Splice a MEMORY ORGANELLE into an existing connection.

Add input link to a random neuron.

Splice a LEAKY INTEGRATOR into an existing connection.

Add a new neuron by splitting a connection.

Add output link from a random neuron.

Add a new sensor to the network.

Add link from a sensor to a neuron.

Add neuron by outsplicing (split output connection).

Functions

add_actuator(AgentId)

-spec add_actuator(term()) -> ok | {error, term()}.

Add a new actuator to the network.

Selects an actuator type from the morphology that isn't already in the network, creates it, and connects a random neuron to it. Enables networks to evolve new action capabilities.

add_actuatorlink(AgentId)

-spec add_actuatorlink(term()) -> ok | {error, term()}.

Add link from a neuron to an actuator.

add_bias(AgentId)

-spec add_bias(term()) -> ok | {error, term()}.

Add bias input to a random neuron.

Adds a bias connection (self-connection) to a neuron that doesn't already have one.

add_delay(AgentId)

-spec add_delay(term()) -> ok | {error, term()}.

Splice a MEMORY ORGANELLE into an existing connection.

A to B becomes A to D to B, where D is a neuron whose neuron_type is delay: it emits what it captured last tick and applies no activation. Chained, these are a delay line, which is the structure insight 023 found when it dumped the wiring of a network that had actually solved a memory task: a pure linear chain, every neuron with exactly one input.

========================================================================== WHY THE WEIGHTS GO WHERE THEY DO ==========================================================================

add_neuron/1 splices with the original weight on the new neuron's input and again on the link out, which squares the path gain. For a delay that would make the organelle a gain change as well as a delay, and the two effects would be inseparable afterwards.

So the delay's input weight is 1.0 and the original weight moves to the link out. The path gain is preserved exactly and the mutation does one thing: it costs the signal a tick.

========================================================================== NOT IN THE DEFAULT OPERATOR LIST, AND THIS IS NOT AN OVERSIGHT ==========================================================================

A delay is evaluated by genotype_to_dag and by nothing else. The process-per-neuron phenotype has no delay process, so exoself and constructor now RAISE on one rather than spawning a standard neuron that would silently ignore the type. A population driven by population_monitor would therefore crash the moment this operator fired.

Add it to a constraint's mutation_operators deliberately, for a population evaluated through the DAG path. It is a capability the substrate offers and the process path does not, and pretending otherwise is what the raise prevents.

add_inlink(AgentId)

-spec add_inlink(term()) -> ok | {error, term()}.

Add input link to a random neuron.

Connects a sensor or another neuron to a neuron that it's not currently connected to.

add_leaky(AgentId)

-spec add_leaky(term()) -> ok | {error, term()}.

Splice a LEAKY INTEGRATOR into an existing connection.

The other organelle. Where a delay holds a value for exactly one tick, a leaky integrator moves its state toward its input by one part in tau each tick, so it carries a decaying trace rather than a discrete memory. It reads this tick's inputs, so unlike a delay it is ordered normally and does NOT break a cycle.

The time constant is drawn from the same range create_cfc_feedforward uses for tau, [0.1, 2.0], and it is an ordinary genotype field, so mutate_time_constant perturbs it like any other. That is what makes this an EVOLVABLE organelle rather than a fixed one: placement is chosen by this operator and the constant is then tuned by the machinery that already exists.

⚠ tau below 1.0 OVERSHOOTS rather than smoothing, since the update moves the state more than the whole way to its input. That is a real part of the parameter's range and is deliberately not clamped away; what is refused, in genotype_to_dag, is a tau of zero or less, which the update cannot evaluate at all.

Weights follow add_delay's reasoning, not add_neuron's: unity in, the original weight on the link out, so the mutation adds a dynamic and does not also change the path gain.

Like add_delay, deliberately absent from the default operator list. The process phenotype has no leaky process and raises rather than running one as an ordinary neuron.

add_neuron(AgentId)

-spec add_neuron(term()) -> ok | {error, term()}.

Add a new neuron by splitting a connection.

Selects a random connection, removes it, and inserts a new neuron in the middle.

add_outlink(AgentId)

-spec add_outlink(term()) -> ok | {error, term()}.

Add output link from a random neuron.

Connects a neuron to another neuron or actuator that it's not currently connected to.

add_sensor(AgentId)

-spec add_sensor(term()) -> ok | {error, term()}.

Add a new sensor to the network.

Selects a sensor type from the morphology that isn't already in the network, creates it, and connects it to a random neuron. Enables networks to evolve new perception capabilities.

add_sensorlink(AgentId)

-spec add_sensorlink(term()) -> ok | {error, term()}.

Add link from a sensor to a neuron.

outsplice(AgentId)

-spec outsplice(term()) -> ok | {error, term()}.

Add neuron by outsplicing (split output connection).

Similar to add_neuron but specifically targets output connections.