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

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

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

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

    A point of crossover of the list is selected with a given rate.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Random random  
      protected double rate  
    • 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

      • random

        protected final java.util.Random random
      • rate

        protected final double rate
    • Constructor Detail

      • CrossoverListRate

        @Inject
        public CrossoverListRate​(double rate,
                                 org.opt4j.core.common.random.Rand random)
        Constructs a new CrossoverListRate.
        Parameters:
        rate - the rate for a crossover
        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