Documentation of 'org.apache.commons.math3.genetics.CycleCrossover' Java class
CycleCrossover
org.apache.commons.math3.genetics

Class CycleCrossover<T>

  • Type Parameters:
    T - generic type of the AbstractListChromosomes for crossover
    All Implemented Interfaces:
    CrossoverPolicy


    public class CycleCrossover<T>
    extends java.lang.Object
    implements CrossoverPolicy
    Cycle Crossover [CX] builds offspring from ordered chromosomes by identifying cycles between two parent chromosomes. To form the children, the cycles are copied from the respective parents.

    To form a cycle the following procedure is applied:

    1. start with the first gene of parent 1
    2. look at the gene at the same position of parent 2
    3. go to the position with the same gene in parent 1
    4. add this gene index to the cycle
    5. repeat the steps 2-5 until we arrive at the starting gene of this cycle
    The indices that form a cycle are then used to form the children in alternating order, i.e. in cycle 1, the genes of parent 1 are copied to child 1, while in cycle 2 the genes of parent 1 are copied to child 2, and so forth ...

    Example (zero-start cycle):
     p1 = (8 4 7 3 6 2 5 1 9 0)    X   c1 = (8 1 2 3 4 5 6 7 9 0)
     p2 = (0 1 2 3 4 5 6 7 8 9)    X   c2 = (0 4 7 3 6 2 5 1 8 9)
    
     cycle 1: 8 0 9
     cycle 2: 4 1 7 2 5 6
     cycle 3: 3
     
    This policy works only on AbstractListChromosome, and therefore it is parameterized by T. Moreover, the chromosomes must have same lengths.
    Since:
    3.1
    See Also:
    Cycle Crossover Operator
    • Constructor Detail

      • CycleCrossover

        public CycleCrossover()
        Creates a new CycleCrossover policy.
      • CycleCrossover

        public CycleCrossover(boolean randomStart)
        Creates a new CycleCrossover policy using the given randomStart behavior.
        Parameters:
        randomStart - whether the start index shall be chosen randomly or be set to 0

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.