Module io.jenetics.base
Package io.jenetics
Class CombineAlterer<G extends Gene<?,G>,C extends Comparable<? super C>>
java.lang.Object
io.jenetics.AbstractAlterer<G,C>
io.jenetics.Recombinator<G,C>
io.jenetics.CombineAlterer<G,C>
- All Implemented Interfaces:
Alterer<G,C>
- Direct Known Subclasses:
MeanAlterer
public class CombineAlterer<G extends Gene<?,G>,C extends Comparable<? super C>>
extends Recombinator<G,C>
Alters a chromosome by replacing two genes by the result of a given
combiner function.
The order (Recombinator.order()) of this recombination implementation is two.
- Since:
- 6.0
- Version:
- 6.0
-
Field Summary
Fields inherited from class io.jenetics.AbstractAlterer
_probabilityFields inherited from interface io.jenetics.Alterer
DEFAULT_ALTER_PROBABILITY -
Constructor Summary
ConstructorsConstructorDescriptionCombineAlterer(BinaryOperator<G> combiner) Create a new combiner alterer with the given arguments.CombineAlterer(BinaryOperator<G> combiner, double probability) Create a new combiner alterer with the given arguments. -
Method Summary
Methods inherited from class io.jenetics.Recombinator
alter, orderMethods inherited from class io.jenetics.AbstractAlterer
probability
-
Constructor Details
-
CombineAlterer
Create a new combiner alterer with the given arguments.- Parameters:
combiner- the function used for combining two genesprobability- The recombination probability.- Throws:
IllegalArgumentException- if theprobabilityis not in the valid range of[0, 1]NullPointerException- if the givencombinerisnull
-
CombineAlterer
Create a new combiner alterer with the given arguments.- Parameters:
combiner- the function used for combining two genes- Throws:
IllegalArgumentException- if theprobabilityis not in the valid range of[0, 1]NullPointerException- if the givencombinerisnull
-
-
Method Details
-
combiner
Return the combiner function, used bythisalterer.- Returns:
- the combiner function, used by
thisalterer
-
recombine
Description copied from class:RecombinatorRecombination template method. This method is called 0 to n times. It is guaranteed that this method is only called by one thread.- Specified by:
recombinein classRecombinator<G extends Gene<?,G>, C extends Comparable<? super C>> - Parameters:
population- the population to recombineindividuals- the array with the indexes of the individuals which are involved in the recombination step. The length of the array isRecombinator.order(). The first individual is the primary individual.generation- the current generation.- Returns:
- the number of genes that has been altered.
-
toString
-