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.
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.
|
boolean |
equals(Object obj) |
int |
getN()
Return the number of crossover points.
|
int |
hashCode() |
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
public int hashCode()
hashCode
in class AbstractAlterer<G extends Gene<?,G>,C extends Comparable<? super C>>
public boolean equals(Object obj)
equals
in class AbstractAlterer<G extends Gene<?,G>,C extends Comparable<? super C>>
© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)