Module io.jenetics.base
Package io.jenetics
Class UniformCrossover<G extends Gene<?,G>,C extends Comparable<? super C>>  
java.lang.Object
io.jenetics.AbstractAlterer<G,C>
 
io.jenetics.Recombinator<G,C>
 
io.jenetics.Crossover<G,C>
 
io.jenetics.UniformCrossover<G,C> 
- All Implemented Interfaces:
- Alterer<G,- C> 
public class UniformCrossover<G extends Gene<?,G>,C extends Comparable<? super C>>  
extends Crossover<G,C> 
The uniform crossover uses swaps single genes between two chromosomes, instead
 of whole ranges as in single- and multipoint crossover.
 
 
 +---+---+---+---+---+---+---+
 | 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 (swapProbability()), whereas the
 probability that a given individual is selected for crossover is defined by
 the crossover-probability (AbstractAlterer.probability()).- Since:
- 3.7
- Version:
- 6.0
- See Also:
- 
Field SummaryFields inherited from class io.jenetics.AbstractAlterer_probabilityFields inherited from interface io.jenetics.AltererDEFAULT_ALTER_PROBABILITY
- 
Constructor SummaryConstructorsConstructorDescriptionCreate 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.
- 
Method SummaryMethods inherited from class io.jenetics.Recombinatoralter, orderMethods inherited from class io.jenetics.AbstractAltererprobability
- 
Constructor Details- 
UniformCrossoverCreate a new universal crossover instance.- Parameters:
- crossoverProbability- the recombination probability as defined in- Crossover(double). This is the probability that a given individual is selected for crossover.
- swapProbability- the probability for swapping a given gene of a chromosome
- Throws:
- IllegalArgumentException- if the probabilities are not in the valid range of- [0, 1]
 
- 
UniformCrossoverCreate a new universal crossover instance. TheswapProbabilityis set toAlterer.DEFAULT_ALTER_PROBABILITY.- Parameters:
- crossoverProbability- the recombination probability as defined in- Crossover(double). This is the probability that a given individual is selected for crossover.
- Throws:
- IllegalArgumentException- if the probabilities are not in the valid range of- [0, 1]
 
- 
UniformCrossoverpublic UniformCrossover()Create a new universal crossover instance. The probabilities are set toAlterer.DEFAULT_ALTER_PROBABILITY.
 
- 
- 
Method Details- 
swapProbabilityReturn the probability for swapping genes of a chromosome.- Returns:
- the probability for swapping genes of a chromosome
 
- 
crossoverDescription copied from class:CrossoverTemplate method which performs the crossover. The arguments given are mutable non-null arrays of the same length.
 
-