Class ListCrossover<T>
- java.lang.Object
-
- org.uncommons.watchmaker.framework.operators.AbstractCrossover<List<T>>
-
- org.uncommons.watchmaker.framework.operators.ListCrossover<T>
-
- Type Parameters:
T
- The component type of the lists that are combined.
- All Implemented Interfaces:
EvolutionaryOperator<List<T>>
public class ListCrossover<T> extends AbstractCrossover<List<T>>
Variable-point (fixed or random) cross-over for arbitrary lists.
-
-
Constructor Summary
Constructors Constructor Description ListCrossover()
Default is single-point cross-over, applied to all parents.ListCrossover(int crossoverPoints)
Cross-over with a fixed number of cross-over points.ListCrossover(int crossoverPoints, Probability crossoverProbability)
Cross-over with a fixed number of cross-over points.ListCrossover(NumberGenerator<Integer> crossoverPointsVariable)
Cross-over with a variable number of cross-over points.ListCrossover(NumberGenerator<Integer> crossoverPointsVariable, NumberGenerator<Probability> crossoverProbabilityVariable)
Cross-over with a variable number of cross-over points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<List<T>>
mate(List<T> parent1, List<T> parent2, int numberOfCrossoverPoints, Random rng)
Perform cross-over on a pair of parents to generate a pair of offspring.-
Methods inherited from class org.uncommons.watchmaker.framework.operators.AbstractCrossover
apply
-
-
-
-
Constructor Detail
-
ListCrossover
public ListCrossover()
Default is single-point cross-over, applied to all parents.
-
ListCrossover
public ListCrossover(int crossoverPoints)
Cross-over with a fixed number of cross-over points.- Parameters:
crossoverPoints
- The constant number of cross-over points to use for all cross-over operations.
-
ListCrossover
public ListCrossover(int crossoverPoints, Probability crossoverProbability)
Cross-over with a fixed number of cross-over points. Cross-over may or may not be applied to a given pair of parents depending on thecrossoverProbability
.- Parameters:
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.
-
ListCrossover
public ListCrossover(NumberGenerator<Integer> crossoverPointsVariable)
Cross-over with a variable number of cross-over points.- Parameters:
crossoverPointsVariable
- A random variable that provides a number of cross-over points for each cross-over operation.
-
ListCrossover
public ListCrossover(NumberGenerator<Integer> crossoverPointsVariable, NumberGenerator<Probability> crossoverProbabilityVariable)
Cross-over with a variable number of cross-over points. Cross-over may or may not be applied to a given pair of parents depending on thecrossoverProbability
.- Parameters:
crossoverPointsVariable
- A random variable that provides a number of cross-over points for each cross-over operation.crossoverProbabilityVariable
- The probability that, once selected, a pair of parents will be subjected to cross-over rather than being copied, unchanged, into the output population.
-
-
Method Detail
-
mate
protected List<List<T>> mate(List<T> parent1, List<T> parent2, int numberOfCrossoverPoints, Random rng)
Perform cross-over on a pair of parents to generate a pair of offspring.- Specified by:
mate
in classAbstractCrossover<List<T>>
- Parameters:
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.- Returns:
- A list containing two evolved offspring.
-
-