Package io.jenetics

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

    • Constructor Detail

      • CombineAlterer

        public CombineAlterer​(BinaryOperator<G> combiner,
                              double probability)
        Create a new combiner alterer with the given arguments.
        Parameters:
        combiner - the function used for combining two genes
        probability - The recombination probability.
        Throws:
        IllegalArgumentException - if the probability is not in the valid range of [0, 1]
        NullPointerException - if the given combiner is null
    • Method Detail

      • combiner

        public BinaryOperator<Gcombiner()
        Return the combiner function, used by this alterer.
        Returns:
        the combiner function, used by this alterer
      • recombine

        protected 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>>
        Parameters:
        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.
        Returns:
        the number of genes that has been altered.