T- generic type of the
AbstractListChromosomes for crossover
public class UniformCrossover<T> extends Object implements CrossoverPolicy
This crossover policy evaluates each gene of the parent chromosomes by chosing a
uniform random number
p in the range [0, 1]. If
the parent genes are swapped. This means with a ratio of 0.7, 30% of the genes from the
first parent and 70% from the second parent will be selected for the first offspring (and
vice versa for the second offspring).
This policy works only on
AbstractListChromosome, and therefore it
is parameterized by T. Moreover, the chromosomes must have same lengths.
|Constructor and Description|
Creates a new
|Modifier and Type||Method and Description|
Perform a crossover operation on the given chromosomes.
Returns the mixing ratio used by this
public double getRatio()
public ChromosomePair crossover(Chromosome first, Chromosome second) throws DimensionMismatchException, MathIllegalArgumentException
first- the first chromosome.
second- the second chromosome.
MathIllegalArgumentException- iff one of the chromosomes is not an instance of
DimensionMismatchException- if the length of the two chromosomes is different
Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.