JGAP

org.jgap.impl
Class DefaultMutationRateCalculator

java.lang.Object
  extended by org.jgap.BaseRateCalculator
      extended by org.jgap.impl.DefaultMutationRateCalculator
All Implemented Interfaces:
java.io.Serializable, IUniversalRateCalculator

public class DefaultMutationRateCalculator
extends BaseRateCalculator

Default implementation of a mutation rate calculcator.

Since:
1.1
See Also:
Serialized Form

Constructor Summary
DefaultMutationRateCalculator(Configuration a_config)
           
 
Method Summary
 int calculateCurrentRate()
          Calculates the mutation rate.
 boolean toBePermutated(IChromosome a_chrom, int a_geneIndex)
          Determines whether mutation is to be carried out.
 
Methods inherited from class org.jgap.BaseRateCalculator
getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMutationRateCalculator

public DefaultMutationRateCalculator(Configuration a_config)
                              throws InvalidConfigurationException
Parameters:
a_config - the configuration to use
Throws:
InvalidConfigurationException
Since:
3.0
Method Detail

calculateCurrentRate

public int calculateCurrentRate()
Calculates the mutation rate.

Returns:
calculated divisor of mutation rate probability (dividend is 1)
Since:
1.1 (same functionality as earlier, but not encapsulated)

toBePermutated

public boolean toBePermutated(IChromosome a_chrom,
                              int a_geneIndex)
Determines whether mutation is to be carried out. In this case the rate is the size of the chromosome. There is therefore a probability of 1/totalgenes that a particular gene mutates.

Parameters:
a_chrom - ignored
a_geneIndex - ignored
Returns:
true if gene should be mutated
Since:
2.0

JGAP