Add More Mutations
vbop9834 opened this issue · comments
I've added the minimal amount of mutations needed for a functioning diverse neural network. There are still more to be added.
1. add_bias:
Choose a random neuron A, check if it has a bias in its weights list, if it does
not, add the bias value. If the neuron already has a bias value, do nothing.
2. remove_bias:
Choose a random neuron A, check if it has a bias in its weights list, if it does,
remove it. If the neuron does not have a bias value, do nothing.
3. mutate_weights:
Choose a random neuron A, and perturb each weight in its weight list with a
probability of 1/sqrt(length(weights)), with the perturbation intensity randomly
chosen between -Pi/2 and Pi/2.
4. reset_weights:
Choose a random neuron A, and reset all its synaptic weights to random values
ranging between -Pi/2 and Pi/2.
5. mutate_af:
Choose a random neuron A, and change its activation function to a new random
activation function chosen from the af_list in the constraint record belonging to
the NN.
6. add_inlink:
Choose a random neuron A, and an element B, and then add a connection from
element B (possibly an existing sensor) to neuron A.
7. add_outlink:
Choose a random neuron A, and an element B, and then add a connection from
neuron A to element B (possibly an existing actuator). The difference between
this mutation operator and the add_inlink mutation operator, is that in one we
choose a random neuron and then choose a random element from which we
make a connection to the chosen neuron. While in the other we choose a random
neuron, and then choose a random element to which the neuron makes a
connection. The first (add_inlink) is capable of making links to sensors, while
the second (add_outlink) is capable of potentially making links to actuators.
8. add_neuron:
Create a new neuron A, giving it a unique id and positioning it in a randomly
selected layer of the NN. Then give the neuron A a randomly chosen activation
function. Then choose a random neuron B in the NN and connect neuron A’s
inport to the neuron B’s outport. Then choose a random neuron C in the NN
and connect neuron A’s outport to the neuron C’s inport.
9. splice: There are 2 versions of this mutation operator, outsplice, and insplice:
– outsplice: Create a new neuron A with a random activation function. Then
choose a random neuron B in the NN. Randomly select neuron B’s outport
leading to some element C’s (neuron or actuator) inport. Then disconnect
neuron B from element C, and reconnect them through the newly created
neuron A.
– insplice: Create a new neuron A with a random activation function. Then
choose a random neuron B in the NN. Randomly select neuron B’s inport
from some element C’s (neuron or sensor) outport. Then disconnect neu-
264 Chapter 8 Developing a Simple Neuroevolutionary Platform
ron B from element C, and reconnect them through the newly created neuron
A. The reason for having an outsplice and an insplice, is that the
outsplice can insert a new neuron between some random element and an
actuator, while the insplice can insert a new neuron between an element
and a sensor.
10. add_sensorlink:
Compared to the number of neurons, there are very few sensors, and so the
probability of the add_inlink connecting a neuron to a sensor is very low. To
increase the probability that the NN connects to a sensor, we can create the
add_sensorlink mutation operator. This mutation operator first chooses a random
existing sensor A, it then chooses a random neuron B to which A is not yet
connected, and then connects A to B.
11. add_actuatorlink:
As in add_sensorlink, when compared to the number of neurons, there are very
few actuators, and so the probability of the add_outlink connecting a neuron to
an actuator is very low. Thus, we can implement the add_actuatorlink to increase
the probability of connecting a neuron to an actuator. In this mutation
operator, first a random actuator A is chosen which is connected to less neurons
than its vl element dictates (an incompletely connected actuator). Then a random
neuron B is chosen to which the actuator is not yet connected. Then A is
connected from B.
12. remove_sensorlink:
First a random sensor A is chosen. From the sensor’s fanout_ids list, a random
neuron id is chosen, and then the sensor is disconnected from the corresponding
neuron.
13. remove_actuatorlink:
First a random actuator A is chosen. From the actuator’s fanin_ids list, a random
neuron id is chosen, and then the actuator is disconnected from the corresponding
neuron.
14. add_sensor:
Choose a random sensor from the sensor list belonging to the NN’s morphology,
but which is not yet used. Then connect the sensor to a random neuron A in
the NN, thus adding a new sensory organ to the NN system.
15. add_actuator:
Choose a random actuator from the actuator list belonging to the NN’s morphology,
but which is not yet used. Then connect a random neuron A in the NN
to this actuator, thus adding a new morphological feature to the NN that can be
used to interact with the world.
16. remove_inlink:
Choose a random neuron A, and disconnect it from a randomly chosen element
in its input_idps list.
17. remove_outlink:
Choose a random neuron A, and disconnect it from a randomly chosen element
in its output_ids list.
8.5 Developing the genotype_mutator 265
18. remove_neuron:
Choose a random neuron A in the NN, and remove it from the topology. Then
fix the presynaptic neuron B’s and postsynaptic neuron C’s outports and inports
respectively to accommodate the removal of the connection with neuron A.
19. desplice: There are 2 versions of this operator, deoutspolice, and deinsplice:
– deoutsplice: Choose a random neuron B in the NN, such that B’s outport
is connected to an element (neuron or actuator) C through some neuron A.
Then delete neuron A and reconnect neuron B and element C directly.
– deintsplice: Choose a random neuron B in the NN, such that B’s inport is
connected to by an element (neuron or sensor) C through some neuron A.
Then delete neuron A and connect neuron B and element C directly.
20. remove_sensor:
If a NN has more than one sensor, choose a random sensor belonging to the
NN, and remove it by first disconnecting it from the neurons it is connected to,
and then removing the tuple representing it from the genotype altogether.
21. remove_actuator:
If a NN has more than one actuator, choose a random actuator belonging the
NN, and remove it by first disconnecting it from the neurons it is connected
from, and then removing the tuple representing it from the genotype altogether.