public class StringCrossover extends AbstractCrossover<java.lang.String>
Constructor and Description |
---|
StringCrossover()
Default is single-point cross-over, applied to all parents.
|
StringCrossover(int crossoverPoints)
Cross-over with a fixed number of cross-over points.
|
StringCrossover(int crossoverPoints,
org.uncommons.maths.random.Probability crossoverProbability)
Cross-over with a fixed number of cross-over points.
|
StringCrossover(org.uncommons.maths.number.NumberGenerator<java.lang.Integer> crossoverPointsVariable)
Cross-over with a variable number of cross-over points.
|
StringCrossover(org.uncommons.maths.number.NumberGenerator<java.lang.Integer> crossoverPointsVariable,
org.uncommons.maths.number.NumberGenerator<org.uncommons.maths.random.Probability> crossoverProbabilityVariable)
Sets up a cross-over implementation that uses a variable number of cross-over
points.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<java.lang.String> |
mate(java.lang.String parent1,
java.lang.String parent2,
int numberOfCrossoverPoints,
java.util.Random rng)
Perform cross-over on a pair of parents to generate a pair of offspring.
|
apply
public StringCrossover()
public StringCrossover(int crossoverPoints)
crossoverPoints
- The constant number of cross-over points
to use for all cross-over operations.public StringCrossover(int crossoverPoints, org.uncommons.maths.random.Probability crossoverProbability)
crossoverProbability
.crossoverPoints
- The constant number of cross-over points
to use for all cross-over operations.crossoverProbability
- The probability that, once selected,
a pair of parents will be subjected to cross-over rather than
being copied, unchanged, into the output population.public StringCrossover(org.uncommons.maths.number.NumberGenerator<java.lang.Integer> crossoverPointsVariable)
crossoverPointsVariable
- A random variable that provides a number
of cross-over points for each cross-over operation.public StringCrossover(org.uncommons.maths.number.NumberGenerator<java.lang.Integer> crossoverPointsVariable, org.uncommons.maths.number.NumberGenerator<org.uncommons.maths.random.Probability> crossoverProbabilityVariable)
crossoverProbabilityVariable
parameter.crossoverPointsVariable
- A variable that provides a (possibly constant,
possibly random) number of cross-over points for each cross-over operation.crossoverProbabilityVariable
- A variable that controls the probability
that, once selected, a pair of parents will be subjected to cross-over rather
than being copied, unchanged, into the output population.protected java.util.List<java.lang.String> mate(java.lang.String parent1, java.lang.String parent2, int numberOfCrossoverPoints, java.util.Random rng)
mate
in class AbstractCrossover<java.lang.String>
parent1
- One of two individuals that provides the source material
for generating offspring.parent2
- One of two individuals that provides the source material
for generating offspring.numberOfCrossoverPoints
- The number of cross-overs performed on the
two parents.rng
- A source of randomness used to determine the location of
cross-over points.