public class UniformCrossover<G extends Gene<?,G>,C extends Comparable<? super C>> extends Crossover<G,C>
+---+---+---+---+---+---+---+ | 1 | 2 | 3 | 4 | 6 | 7 | 8 | +-+-+---+-+-+-+-+---+-+-+---+ | | | | swapping +-+-+---+-+-+-+-+---+-+-+---+ | a | b | c | d | e | f | g | +---+---+---+---+---+---+---+The probability that two genes are swapped is controlled by the swap-probability (
getSwapProbability()
), whereas the
probability that a given individual is selected for crossover is defined by
the crossover-probability (AbstractAlterer.getProbability()
)._probability
DEFAULT_ALTER_PROBABILITY
Constructor and Description |
---|
UniformCrossover()
Create a new universal crossover instance.
|
UniformCrossover(double crossoverProbability)
Create a new universal crossover instance.
|
UniformCrossover(double crossoverProbability,
double swapProbability)
Create a new universal crossover instance.
|
Modifier and Type | Method and Description |
---|---|
protected int |
crossover(MSeq<G> that,
MSeq<G> other)
Template method which performs the crossover.
|
double |
getSwapProbability()
Return the probability for swapping genes of a chromosome.
|
alter, getOrder
getProbability
public UniformCrossover(double crossoverProbability, double swapProbability)
crossoverProbability
- the recombination probability as defined in
Crossover.Crossover(double)
. This is the probability that
a given individual is selected for crossover.swapProbability
- the probability for swapping a given gene of
a chromosomeIllegalArgumentException
- if the probabilities are not in the
valid range of [0, 1]
public UniformCrossover(double crossoverProbability)
swapProbability
is
set to Alterer.DEFAULT_ALTER_PROBABILITY
.crossoverProbability
- the recombination probability as defined in
Crossover.Crossover(double)
. This is the probability that
a given individual is selected for crossover.IllegalArgumentException
- if the probabilities are not in the
valid range of [0, 1]
public UniformCrossover()
Alterer.DEFAULT_ALTER_PROBABILITY
.public double getSwapProbability()
© 2007-2019 Franz Wilhelmstötter (2019-11-18 20:30)