JGAP

examples.monalisa.core
Class PolygonMutationOperator

java.lang.Object
  extended by org.jgap.BaseGeneticOperator
      extended by org.jgap.impl.MutationOperator
          extended by examples.monalisa.core.PolygonMutationOperator
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Configurable, GeneticOperator

public class PolygonMutationOperator
extends MutationOperator

Translates a polygon of each chromosome in a random direction.

Since:
3.4
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jgap.BaseGeneticOperator
m_monitor, m_monitorActive
 
Constructor Summary
PolygonMutationOperator(Configuration a_config, int a_desiredMutationRate)
           
 
Method Summary
 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.
 
Methods inherited from class org.jgap.impl.MutationOperator
compareTo, equals, getMutationRate, getMutationRateCalc, setMutationRate, setMutationRateCalc
 
Methods inherited from class org.jgap.BaseGeneticOperator
getConfiguration
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonMutationOperator

public PolygonMutationOperator(Configuration a_config,
                               int a_desiredMutationRate)
                        throws InvalidConfigurationException
Throws:
InvalidConfigurationException
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.

Specified by:
operate in interface GeneticOperator
Overrides:
operate in class MutationOperator
Parameters:
a_population - the population of chromosomes from the current evolution prior to exposure to any genetic operators. Chromosomes in this array should not be modified. Please notice, that the call in Genotype.evolve() to the implementations of GeneticOperator overgoes this due to performance issues
a_candidateChromosomes - the pool of chromosomes that have been mutated

JGAP