mutation_helpers (macula_tweann v0.18.1)

View Source

Helper functions for genome mutation operations.

This module provides utility functions used by mutation operators for linking network elements and weight management.

Summary

Functions

Create a random weight tuple.

Find a link that can be split to insert a neuron.

Get layer coordinate from element ID.

Get weight of a link between two elements.

Link a neuron to a target (neuron or actuator).

Link a source (sensor or neuron) to a neuron.

Perturb a list of LTC weights.

Select a random LTC or CfC neuron from the agent's network.

Select a random neuron from the agent's network.

Update source element to output to new target.

Update target element to receive from new source.

Functions

create_random_weight()

-spec create_random_weight() -> {float(), float(), float(), []}.

Create a random weight tuple.

find_splittable_link(AgentId)

-spec find_splittable_link(term()) ->
                              {term(), term(), {float(), float(), float(), list()}} | {error, no_links}.

Find a link that can be split to insert a neuron.

get_layer_coord(_)

-spec get_layer_coord(term()) -> float().

Get layer coordinate from element ID.

perturb_ltc_weight_list(Weights, PerturbRange)

-spec perturb_ltc_weight_list([float()], float()) -> [float()].

Perturb a list of LTC weights.

select_ltc_neuron(AgentId)

-spec select_ltc_neuron(term()) -> term() | {error, no_ltc_neurons | no_neurons}.

Select a random LTC or CfC neuron from the agent's network.

select_random_neuron(AgentId)

-spec select_random_neuron(term()) -> term() | {error, no_neurons}.

Select a random neuron from the agent's network.

update_source_output(FromId, OldToId, NewToId)

-spec update_source_output(term(), term(), term()) -> ok.

Update source element to output to new target.

update_target_input(ToId, OldFromId, NewFromId, Weight)

-spec update_target_input(term(), term(), term(), {float(), float(), float(), list()}) -> ok.

Update target element to receive from new source.