org.jgap.impl
Class MutationOperator

java.lang.Object
  extended byorg.jgap.impl.MutationOperator
All Implemented Interfaces:
GeneticOperator, java.io.Serializable
Direct Known Subclasses:
SwappingMutationOperator

public class MutationOperator
extends java.lang.Object
implements GeneticOperator

The mutation operator runs through the genes in each of the Chromosomes in the population and mutates them in statistical accordance to the given mutation rate. Mutated Chromosomes are then added to the list of candidate Chromosomes destined for the natural selection process.

This MutationOperator supports both fixed and dynamic mutation rates. A fixed rate is one specified at construction time by the user. A dynamic rate is one determined by this class if no fixed rate is provided, and is calculated based on the size of the Chromosomes in the population such that, on average, one gene will be mutated for every ten Chromosomes processed by this operator.

Since:
1.0
Author:
Neil Rotstan, Klaus Meffert
See Also:
Serialized Form

Constructor Summary
MutationOperator()
          Constructs a new instance of this MutationOperator without a specified mutation rate, which results in dynamic mutation being turned on.
MutationOperator(int a_desiredMutationRate)
          Constructs a new instance of this MutationOperator with the given mutation rate.
MutationOperator(IUniversalRateCalculator a_mutationRateCalculator)
          Constructs a new instance of this MutationOperator with a specified mutation rate calculator, which results in dynamic mutation being turned on.
 
Method Summary
 IUniversalRateCalculator getMutationRateCalc()
           
 void operate(Population a_population, java.util.List a_candidateChromosomes)
          The operate method will be invoked on each of the genetic operators referenced by the current Configuration object during the evolution phase.
 void setMutationRateCalc(IUniversalRateCalculator m_mutationRateCalc)
          Sets the MutationRateCalculator to be used for determining the strengt of mutation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutationOperator

public MutationOperator()
Constructs a new instance of this MutationOperator without a specified mutation rate, which results in dynamic mutation being turned on. This means that the mutation rate will be automatically determined by this operator based upon the number of genes present in the chromosomes.

Since:
1.0

MutationOperator

public MutationOperator(IUniversalRateCalculator a_mutationRateCalculator)
Constructs a new instance of this MutationOperator with a specified mutation rate calculator, which results in dynamic mutation being turned on.

Parameters:
a_mutationRateCalculator - calculator for dynamic mutation rate computation
Since:
1.1

MutationOperator

public MutationOperator(int a_desiredMutationRate)
Constructs a new instance of this MutationOperator with the given mutation rate.

Parameters:
a_desiredMutationRate - The desired rate of mutation, expressed as the denominator of the 1 / X fraction. For example, 1000 would result in 1/1000 genes being mutated on average. A mutation rate of zero disables mutation entirely.
Since:
1.1
Method Detail

operate

public void operate(Population a_population,
                    java.util.List a_candidateChromosomes)
The operate method will be invoked on each of the genetic operators referenced by the current Configuration object during the evolution phase. Operators are given an opportunity to run in the order that they are added to the Configuration. Implementations of this method may reference the population of Chromosomes as it was at the beginning of the evolutionary phase and/or they may instead reference the candidate Chromosomes, which are the results of prior genetic operators. In either case, only Chromosomes added to the list of candidate chromosomes will be considered for natural selection. Implementations should never modify the original population, but should first make copies of the Chromosomes selected for modification and operate upon the copies.

Specified by:
operate in interface GeneticOperator
Parameters:
a_population - The population of chromosomes from the current evolution prior to exposure to any genetic operators. Chromosomes in this array should never be modified.
a_candidateChromosomes - The pool of chromosomes that are candidates for the next evolved population. Only these chromosomes will go to the natural phase, so it's important to add any modified copies of Chromosomes to this list if it's desired for them to be considered for natural selection.
Since:
1.0

getMutationRateCalc

public IUniversalRateCalculator getMutationRateCalc()
Returns:
the MutationRateCalculator used
Since:
1.1

setMutationRateCalc

public void setMutationRateCalc(IUniversalRateCalculator m_mutationRateCalc)
Sets the MutationRateCalculator to be used for determining the strengt of mutation

Parameters:
m_mutationRateCalc - MutationRateCalculator
Since:
1.1