T - generic type of the AbstractListChromosomes for crossoverpublic class NPointCrossover<T> extends Object implements CrossoverPolicy
 -C- denotes a crossover point
           -C-       -C-                         -C-        -C-
 p1 = (1 0  | 1 0 0 1 | 0 1 1)    X    p2 = (0 1  | 1 0 1 0  | 1 1 1)
      \----/ \-------/ \-----/              \----/ \--------/ \-----/
        ||      (*)       ||                  ||      (**)       ||
        VV      (**)      VV                  VV      (*)        VV
      /----\ /--------\ /-----\             /----\ /--------\ /-----\
 c1 = (1 0  | 1 0 1 0  | 0 1 1)    X   c2 = (0 1  | 1 0 0 1  | 0 1 1)
 
 This policy works only on AbstractListChromosome, and therefore it
 is parameterized by T. Moreover, the chromosomes must have same lengths.| Constructor and Description | 
|---|
| NPointCrossover(int crossoverPoints)Creates a new  NPointCrossoverpolicy using the given number of points. | 
| Modifier and Type | Method and Description | 
|---|---|
| ChromosomePair | crossover(Chromosome first,
         Chromosome second)Performs a N-point crossover. | 
| int | getCrossoverPoints()Returns the number of crossover points used by this  CrossoverPolicy. | 
public NPointCrossover(int crossoverPoints)
                throws NotStrictlyPositiveException
NPointCrossover policy using the given number of points.
 
 Note: the number of crossover points must be < chromosome length - 1.
 This condition can only be checked at runtime, as the chromosome length is not known in advance.
crossoverPoints - the number of crossover pointsNotStrictlyPositiveException - if the number of crossoverPoints is not strictly positivepublic int getCrossoverPoints()
CrossoverPolicy.public ChromosomePair crossover(Chromosome first, Chromosome second) throws DimensionMismatchException, MathIllegalArgumentException
 -C- denotes a crossover point
           -C-       -C-                         -C-        -C-
 p1 = (1 0  | 1 0 0 1 | 0 1 1)    X    p2 = (0 1  | 1 0 1 0  | 1 1 1)
      \----/ \-------/ \-----/              \----/ \--------/ \-----/
        ||      (*)       ||                  ||      (**)       ||
        VV      (**)      VV                  VV      (*)        VV
      /----\ /--------\ /-----\             /----\ /--------\ /-----\
 c1 = (1 0  | 1 0 1 0  | 0 1 1)    X   c2 = (0 1  | 1 0 0 1  | 0 1 1)
 crossover in interface CrossoverPolicyfirst - first parent (p1)second - second parent (p2)MathIllegalArgumentException - iff one of the chromosomes is
   not an instance of AbstractListChromosomeDimensionMismatchException - if the length of the two chromosomes is differentCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.