com.anji.neat
Class RemoveConnectionMutationOperator

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

public class RemoveConnectionMutationOperator
extends MutationOperator
implements Configurable

Implements remove connection mutation, using one of 3 strategies: SKEWED - Probability of connection being removed ranges from 0 (if weight magnitude >= max weight removed) to mutation rate (if weight is 0) ALL - All connections have equal likelihood of being removed, regardless of weight. SMALL - Mutation occurs according to James and Tucker's "A Comparative Analysis of Simplification and Complexification in the Evolution of Neural Network Topologies" paper for GECCO 2004 .

Author:
Philip Tucker

Nested Class Summary
static class RemoveConnectionMutationOperator.Strategy
          Enumerated type for remove connection strategies.
 
Field Summary
static float DEFAULT_MAX_WEIGHT_REMOVED
          default maximum weight a connection can have and still be removed
static float DEFAULT_MUTATE_RATE
          default mutation rate
static java.lang.String REMOVE_CONN_MAX_WEIGHT_KEY
          properties key, max weight that can be removed by remove connection mutation
 
Constructor Summary
RemoveConnectionMutationOperator()
           
RemoveConnectionMutationOperator(float aMutationRate)
           
RemoveConnectionMutationOperator(float aMutationRate, float aMaxWeightRemoved)
           
RemoveConnectionMutationOperator(float aMutationRate, float aMaxWeightRemoved, RemoveConnectionMutationOperator.Strategy aStrategy)
           
 
Method Summary
 float getMaxWeightRemoved()
           
 void init(Properties props)
           
protected  void mutate(Configuration jgapConfig, ChromosomeMaterial target, java.util.Set allelesToAdd, java.util.Set allelesToRemove)
          Removes, in ascending order of weight magnitude, those connections whose weight magnitude is less than the maximum weight to be removed.
 
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

REMOVE_CONN_MAX_WEIGHT_KEY

public static final java.lang.String REMOVE_CONN_MAX_WEIGHT_KEY
properties key, max weight that can be removed by remove connection mutation

See Also:
Constant Field Values

DEFAULT_MAX_WEIGHT_REMOVED

public static final float DEFAULT_MAX_WEIGHT_REMOVED
default maximum weight a connection can have and still be removed

See Also:
Constant Field Values

DEFAULT_MUTATE_RATE

public static final float DEFAULT_MUTATE_RATE
default mutation rate

See Also:
Constant Field Values
Constructor Detail

RemoveConnectionMutationOperator

public RemoveConnectionMutationOperator()
See Also:
RemoveConnectionMutationOperator(float)

RemoveConnectionMutationOperator

public RemoveConnectionMutationOperator(float aMutationRate)
See Also:
MutationOperator.MutationOperator(float)

RemoveConnectionMutationOperator

public RemoveConnectionMutationOperator(float aMutationRate,
                                        float aMaxWeightRemoved)
Parameters:
aMutationRate -
aMaxWeightRemoved - weights larger than this can not be removed
See Also:
MutationOperator.MutationOperator(float)

RemoveConnectionMutationOperator

public RemoveConnectionMutationOperator(float aMutationRate,
                                        float aMaxWeightRemoved,
                                        RemoveConnectionMutationOperator.Strategy aStrategy)
Parameters:
aMutationRate -
aMaxWeightRemoved - weights larger than this can not be removed
aStrategy -
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 jgapConfig,
                      ChromosomeMaterial target,
                      java.util.Set allelesToAdd,
                      java.util.Set allelesToRemove)
Removes, in ascending order of weight magnitude, those connections whose weight magnitude is less than the maximum weight to be removed. Maximum number of connections that can be removed is determined by mutation rate.

Specified by:
mutate in class MutationOperator
Parameters:
jgapConfig - must be NeatConfiguration
target - chromosome material to mutate
allelesToAdd - Set contains Allele objects
allelesToRemove - Set contains Allele objects
See Also:
MutationOperator.mutate(org.jgap.Configuration, org.jgap.ChromosomeMaterial, java.util.Set, java.util.Set)

getMaxWeightRemoved

public float getMaxWeightRemoved()
Returns:
float threshold above which no weight is removed