Class CrossoverDouble

  • All Implemented Interfaces:
    org.opt4j.core.optimizer.Operator<org.opt4j.core.genotype.DoubleGenotype>, Crossover<org.opt4j.core.genotype.DoubleGenotype>
    Direct Known Subclasses:
    CrossoverDoubleElementwise, CrossoverDoubleUnfairAverage

    public abstract class CrossoverDouble
    extends java.lang.Object
    implements Crossover<org.opt4j.core.genotype.DoubleGenotype>
    Crossover for the DoubleGenotype.
    • Constructor Summary

      Constructors 
      Constructor Description
      CrossoverDouble​(NormalizeDouble normalize, org.opt4j.core.common.random.Rand random)
      Constructs a new crossover for the DoubleGenotype.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void crossover​(java.util.List<java.lang.Double> p1, java.util.List<java.lang.Double> p2, java.util.List<java.lang.Double> o1, java.util.List<java.lang.Double> o2)
      Performs a crossover of two parent Genotypes that consist of double vectors.
      Pair<org.opt4j.core.genotype.DoubleGenotype> crossover​(org.opt4j.core.genotype.DoubleGenotype p1, org.opt4j.core.genotype.DoubleGenotype 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

      • random

        protected final java.util.Random random
    • Constructor Detail

      • CrossoverDouble

        @Inject
        public CrossoverDouble​(NormalizeDouble normalize,
                               org.opt4j.core.common.random.Rand random)
        Constructs a new crossover for the DoubleGenotype.
        Parameters:
        normalize - a normalize operator
        random - the random number generator
    • Method Detail

      • crossover

        public Pair<org.opt4j.core.genotype.DoubleGenotype> crossover​(org.opt4j.core.genotype.DoubleGenotype p1,
                                                                      org.opt4j.core.genotype.DoubleGenotype 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<org.opt4j.core.genotype.DoubleGenotype>
        Parameters:
        p1 - The first parent genotype for the crossover
        p2 - The second parents genotype for the crossover
        Returns:
        The resulting pair of offspring genotypes
      • crossover

        protected abstract void crossover​(java.util.List<java.lang.Double> p1,
                                          java.util.List<java.lang.Double> p2,
                                          java.util.List<java.lang.Double> o1,
                                          java.util.List<java.lang.Double> o2)
        Performs a crossover of two parent Genotypes that consist of double vectors.
        Parameters:
        p1 - the first parent
        p2 - the second parent
        o1 - the first offspring
        o2 - the second offspring