Package io.jenetics

Class Crossover<G extends Gene<?,​G>,​C extends Comparable<? super C>>

    • Constructor Detail

      • Crossover

        protected Crossover​(double probability)
        Constructs an alterer with a given recombination probability.
        probability - the recombination probability
        IllegalArgumentException - if the probability is not in the valid range of [0, 1]
    • Method Detail

      • recombine

        protected final int recombine​(MSeq<Phenotype<G,​C>> population,
                                      int[] individuals,
                                      long generation)
        Description copied from class: Recombinator
        Recombination template method. This method is called 0 to n times. It is guaranteed that this method is only called by one thread.
        Specified by:
        recombine in class Recombinator<G extends Gene<?,​G>,​C extends Comparable<? super C>>
        population - the population to recombine
        individuals - the array with the indexes of the individuals which are involved in the recombination step. The length of the array is Recombinator.order(). The first individual is the primary individual.
        generation - the current generation.
        the number of genes that has been altered.
      • crossover

        protected abstract int crossover​(MSeq<G> that,
                                         MSeq<G> other)
        Template method which performs the crossover. The arguments given are mutable non null arrays of the same length.
        that - the genes of the first chromosome
        other - the genes of the other chromosome
        the number of altered genes