com.anji.neat
Class PruneMutationOperator

java.lang.Object
  extended byorg.jgap.MutationOperator
      extended bycom.anji.neat.PruneMutationOperator
All Implemented Interfaces:
Configurable

public class PruneMutationOperator
extends MutationOperator
implements Configurable

Removes neurons and connections that do not affect the activation of the network. This includes hidden neurons without inputs or outputs, connections missing source or destination neurons, or sub-structures of neurons and connections that are stranded. Allows additive and subtractive mutation operators to be less careful about what they do and require less coordination among them, since this operator can follow them and "clean up the mess". For this reason, this operator generally should be the last executed in the sequence of mutation operators. This operator was necessary with the addition of simplification dynamics for James and Tucker's "A Comparative Analysis of Simplification and Complexification in the Evolution of Neural Network Topologies" paper for GECCO 2004 . TODO - mutation rate less than 1.0 might yield unexpected results - maybe should handle nodes and connections differently in that case

Author:
Philip Tucker

Field Summary
static float DEFAULT_MUTATE_RATE
          default mutation rate
 
Constructor Summary
PruneMutationOperator()
           
PruneMutationOperator(float newMutationRate)
           
 
Method Summary
 void init(Properties props)
           
protected  void mutate(Configuration config, ChromosomeMaterial target, java.util.Set genesToAdd, java.util.Set genesToRemove)
          Traverse network flowing forward and backward to identify unvisited connections and neurons.
 
Methods inherited from class org.jgap.MutationOperator
doesMutationOccur, doesMutationOccur, getMutationRate, mutate, numMutations, setMutationRate, updateMaterial
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MUTATE_RATE

public static final float DEFAULT_MUTATE_RATE
default mutation rate

See Also:
Constant Field Values
Constructor Detail

PruneMutationOperator

public PruneMutationOperator()
See Also:
PruneMutationOperator(float)

PruneMutationOperator

public PruneMutationOperator(float newMutationRate)
See Also:
MutationOperator.MutationOperator(float)
Method Detail

init

public void init(Properties props)
          throws java.lang.Exception
Specified by:
init in interface Configurable
Parameters:
props - configuration parameters
Throws:
java.lang.Exception
See Also:
Configurable.init(com.anji.util.Properties)

mutate

protected void mutate(Configuration config,
                      ChromosomeMaterial target,
                      java.util.Set genesToAdd,
                      java.util.Set genesToRemove)
Traverse network flowing forward and backward to identify unvisited connections and neurons. Then, remove a number of those depending on mutation rate.

Specified by:
mutate in class MutationOperator
Parameters:
config -
target - chromosome material to mutate
genesToAdd - Set contains Gene objects
genesToRemove - Set contains Gene objects
See Also:
MutationOperator.mutate(org.jgap.Configuration, org.jgap.ChromosomeMaterial, java.util.Set, java.util.Set)