public abstract class Recombinator<G extends Gene<?,G>,C extends Comparable<? super C>> extends AbstractAlterer<G,C>
An enhanced genetic algorithm (EGA) combine elements of existing solutions in order to create a new solution, with some of the properties of each parent. Recombination creates a new chromosome by combining parts of two (or more) parent chromosomes. This combination of chromosomes can be made by selecting one or more crossover points, splitting these chromosomes on the selected points, and merge those portions of different chromosomes to form new ones.
The recombination probability P(r) determines the probability that a
given individual (genotype, not gene) of a population is selected for
recombination. The (mean) number of changed individuals depend on the
concrete implementation and can be vary from
P(r)·N_{G} to
P(r)·N_{G}·O_{R}, where
O_{R} is the order of the recombination, which is the number
of individuals involved int the recombine(org.jenetics.Population<G, C>, int[], long)
method.
_probability
DEFAULT_ALTER_PROBABILITY
Modifier  Constructor and Description 

protected 
Recombinator(double probability,
int order)
Constructs an alterer with a given recombination probability.

Modifier and Type  Method and Description 

int 
alter(Population<G,C> population,
long generation)
Alters (recombine) a given population.

int 
getOrder()
Return the number of individuals involved in the
recombine(Population, int[], long) step. 
protected abstract int 
recombine(Population<G,C> population,
int[] individuals,
long generation)
Recombination template method.

equals, getProbability, hashCode
protected Recombinator(double probability, int order)
probability
 The recombination probability.order
 the number of individuals involved in the
recombine(Population, int[], long)
stepIllegalArgumentException
 if the probability
is not in the
valid range of [0, 1]
or the given order
is
smaller than two.public int getOrder()
recombine(Population, int[], long)
step.public final int alter(Population<G,C> population, long generation)
Alterer
population
is empty,
nothing is altered. The altering of the population is done in place; the
given population is altered.population
 The Population to be altered. If the
population
is null
or empty, nothing is altered.generation
 the date of birth (generation) of the altered phenotypes.protected abstract int recombine(Population<G,C> population, int[] individuals, long generation)
population
 the population to recombineindividuals
 the array with the indexes of the individuals which
are involved in the recombination step. The length of the
array is getOrder()
. The first individual is the
primary individual.generation
 the current generation.© 20072017 Franz Wilhelmstötter (20170822 19:30)