public class MultiPointCrossover<G extends Gene<?,G>,C extends Comparable<? super C>> extends Crossover<G,C>
Multiple point crossover
If theMultiPointCrossover
is created with one crossover point, it
behaves exactly like the SinglePointCrossover
. The following picture
shows how the MultiPointCrossover
works with two crossover points,
defined at index 1 and 4.
If the number of crossover points is odd, the crossover looks like in the following figure.
SinglePointCrossover
_probability
DEFAULT_ALTER_PROBABILITY
Constructor and Description |
---|
MultiPointCrossover()
Create a new crossover instance with two crossover points and crossover
probability 0.05.
|
MultiPointCrossover(double probability)
Create a new crossover instance with two crossover points.
|
MultiPointCrossover(double probability,
int n)
Create a new crossover instance.
|
MultiPointCrossover(int n)
Create a new crossover instance with default crossover probability of
0.05.
|
Modifier and Type | Method and Description |
---|---|
protected int |
crossover(MSeq<G> that,
MSeq<G> other)
Template method which performs the crossover.
|
int |
getN()
Return the number of crossover points.
|
String |
toString() |
alter, getOrder
getProbability
public MultiPointCrossover(double probability, int n)
probability
- the recombination probability.n
- the number of crossover points.IllegalArgumentException
- if the probability
is not in the
valid range of [0, 1]
or n < 1
.public MultiPointCrossover(double probability)
probability
- the recombination probability.IllegalArgumentException
- if the probability
is not in the
valid range of [0, 1]
.public MultiPointCrossover(int n)
n
- the number of crossover points.IllegalArgumentException
- if n < 1
.public MultiPointCrossover()
public int getN()
protected int crossover(MSeq<G> that, MSeq<G> other)
Crossover
© 2007-2019 Franz Wilhelmstötter (2019-11-18 20:30)