Class CrossoverListXPoint<G extends org.opt4j.core.genotype.ListGenotype<?>>

  • All Implemented Interfaces:
    org.opt4j.core.optimizer.Operator<G>, Crossover<G>
    Direct Known Subclasses:
    CrossoverBooleanXPoint, CrossoverIntegerXPoint

    public abstract class CrossoverListXPoint<G extends org.opt4j.core.genotype.ListGenotype<?>>
    extends java.lang.Object
    implements Crossover<G>

    The CrossoverListXPoint performs a crossover on Genotype objects that are lists of values.

    The crossover is performed on x points of the Genotype.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Random random  
      protected int x  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Pair<G> crossover​(G p1, G p2)
      Performs a crossover for two Genotype parents.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • x

        protected final int x
      • random

        protected final java.util.Random random
    • Constructor Detail

      • CrossoverListXPoint

        @Inject
        public CrossoverListXPoint​(int x,
                                   org.opt4j.core.common.random.Rand random)
        Constructs a CrossoverListXPoint.
        Parameters:
        x - the number of crossover points
        random - the random number generator
    • Method Detail

      • crossover

        public Pair<G> crossover​(G p1,
                                 G p2)
        Description copied from interface: Crossover
        Performs a crossover for two Genotype parents. The resulting pair of Genotype offspring is returned.
        Specified by:
        crossover in interface Crossover<G extends org.opt4j.core.genotype.ListGenotype<?>>
        Parameters:
        p1 - The first parent genotype for the crossover
        p2 - The second parents genotype for the crossover
        Returns:
        The resulting pair of offspring genotypes