Package io.jenetics

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

    • Constructor Detail

      • MultiPointCrossover

        public MultiPointCrossover​(double probability,
                                   int n)
        Create a new crossover instance.
        Parameters:
        probability - the recombination probability.
        n - the number of crossover points.
        Throws:
        IllegalArgumentException - if the probability is not in the valid range of [0, 1] or n &lt; 1.
      • MultiPointCrossover

        public MultiPointCrossover​(double probability)
        Create a new crossover instance with two crossover points.
        Parameters:
        probability - the recombination probability.
        Throws:
        IllegalArgumentException - if the probability is not in the valid range of [0, 1].
      • MultiPointCrossover

        public MultiPointCrossover​(int n)
        Create a new crossover instance with default crossover probability of 0.05.
        Parameters:
        n - the number of crossover points.
        Throws:
        IllegalArgumentException - if n &lt; 1.
      • MultiPointCrossover

        public MultiPointCrossover()
        Create a new crossover instance with two crossover points and crossover probability 0.05.
    • Method Detail

      • crossoverPointCount

        public int crossoverPointCount()
        Return the number of crossover points.
        Returns:
        the number of crossover points.
      • crossover

        protected int crossover​(MSeq<G> that,
                                MSeq<G> other)
        Description copied from class: Crossover
        Template method which performs the crossover. The arguments given are mutable non null arrays of the same length.
        Specified by:
        crossover in class Crossover<G extends Gene<?,​G>,​C extends Comparable<? super C>>
        Parameters:
        that - the genes of the first chromosome
        other - the genes of the other chromosome
        Returns:
        the number of altered genes