Documentation of 'org.jgap.impl.TwoWayMutationOperator' Java class
TwoWayMutationOperator
org.jgap.impl

Class TwoWayMutationOperator

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable, GeneticOperator


    public class TwoWayMutationOperator
    extends BaseGeneticOperator
    Considers two levels of mutation. At first, this mutation operator assumes all genes within a chromosome to having a different impact on the result when mutated. For that, a gene with fewer impact is selected for mutation more likely than one with bigger impact. After a gene has been selected for mutation, it is indeed mutated in a traditional way.

    See class examples.dynamicMutation.DynamicMutationExample for usage, currently this class only works with that example!

    Since:
    2.6
    See Also:
    Serialized Form
    • Constructor Detail

      • TwoWayMutationOperator

        public TwoWayMutationOperator()
                               throws InvalidConfigurationException
        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.

        Attention: The configuration used is the one set with the static method Genotype.setConfiguration.

        Throws:
        InvalidConfigurationException
        Since:
        2.6
      • TwoWayMutationOperator

        public TwoWayMutationOperator(Configuration a_config)
                               throws InvalidConfigurationException
        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.
        Parameters:
        a_config - the configuration to use
        Throws:
        InvalidConfigurationException
        Since:
        3.1
      • TwoWayMutationOperator

        public TwoWayMutationOperator(Configuration a_config,
                                      IUniversalRateCalculator a_mutationRateCalculator)
                               throws InvalidConfigurationException
        Constructs a new instance of this MutationOperator with a specified mutation rate calculator, which results in dynamic mutation being turned on.
        Parameters:
        a_config - the configuration to use
        a_mutationRateCalculator - calculator for dynamic mutation rate computation
        Throws:
        InvalidConfigurationException
        Since:
        2.6
      • TwoWayMutationOperator

        public TwoWayMutationOperator(Configuration a_config,
                                      int a_desiredMutationRate)
                               throws InvalidConfigurationException
        Constructs a new instance of this MutationOperator with the given mutation rate.
        Parameters:
        a_config - the configuration to use
        a_desiredMutationRate - 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
        Throws:
        InvalidConfigurationException
        Since:
        2.6
    • Method Detail

      • operate

        public void operate(Population a_population,
                            java.util.List a_candidateChromosomes)
        Description copied from interface: GeneticOperator
        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. The parameters a_population and a_candidateChromosomes may refer to the same list of chromosomes for performance issues. Thus would mean an in-place modification. In ealier JGAP versions it was suggested never modifying the input population. Please refer to implementations delivered with JGAP to get a picture of the way non-susceptible in-place modifications are possible. If wrongly done, ConcurrentModificationException could be risen when accessing the population by an iterator in a GeneticOperator. Or, if population.getChromosomes().size() was used inside a loop where chromosomes were added to the input population this could lead to an infinite loop in worst case.
        Parameters:
        a_population - see interface
        a_candidateChromosomes - see interface
        Since:
        2.6
      • getMutationRateCalc

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

        public void setMutationRateCalc(IUniversalRateCalculator a_mutationRateCalc)
        Sets the MutationRateCalculator to be used for determining the strength of mutation.
        Parameters:
        a_mutationRateCalc - MutationRateCalculator
        Since:
        1.1
      • equals

        public boolean equals(java.lang.Object a_other)
        Compares this GeneticOperator against the specified object. The result is true if and the argument is an instance of this class and is equal wrt the data.
        Overrides:
        equals in class BaseGeneticOperator
        Parameters:
        a_other - the object to compare against
        Returns:
        true: if the objects are the same, false otherwise
        Since:
        2.6
      • compareTo

        public int compareTo(java.lang.Object a_other)
        Compares the given GeneticOperator to this GeneticOperator.
        Parameters:
        a_other - the instance against which to compare this instance
        Returns:
        a negative number if this instance is "less than" the given instance, zero if they are equal to each other, and a positive number if this is "greater than" the given instance
        Since:
        2.6
      • getMutationRate

        public int getMutationRate()

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.