Package org.moeaframework.core.operator
Class TypeSafeCrossover<T extends Variable>
java.lang.Object
org.moeaframework.core.operator.TypeSafeCrossover<T>
- Type Parameters:
T
- the type of decision variable this operator supports
- All Implemented Interfaces:
Configurable
,Variation
- Direct Known Subclasses:
GrammarCrossover
,HUX
,PMX
,SSX
,SubtreeCrossover
An abstract variation class that validates the types of each variable before applying the crossover operation with
a given probability.
-
Constructor Summary
ConstructorDescriptionTypeSafeCrossover
(Class<T> type, double probability) Constructs a new variation operator for the given type. -
Method Summary
Modifier and TypeMethodDescriptionSolution[]
Evolves one or more parent solutions (specified bygetArity
) and produces one or more child solutions.abstract void
Performs the crossover operation on two decision variables.int
getArity()
Returns the number of solutions that must be supplied to theevolve
method.double
Returns the probability of applying this operator to each decision variablevoid
setProbability
(double probability) Sets the probability of applying this operator to each decision variable.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.core.configuration.Configurable
applyConfiguration, getConfiguration
-
Constructor Details
-
TypeSafeCrossover
Constructs a new variation operator for the given type.- Parameters:
type
- the type of decision variable this operator supportsprobability
- the probability of applying this operator to each decision variable
-
-
Method Details
-
getProbability
public double getProbability()Returns the probability of applying this operator to each decision variable- Returns:
- the probability between 0.0 and 1.0, inclusive
-
setProbability
public void setProbability(double probability) Sets the probability of applying this operator to each decision variable.- Parameters:
probability
- the probability between 0.0 and 1.0, inclusive
-
evolve
Description copied from interface:Variation
Evolves one or more parent solutions (specified bygetArity
) and produces one or more child solutions. By contract, the parents must not be modified. The copy constructor should be used to create copies of the parents with these copies subsequently modified. -
getArity
public int getArity()Description copied from interface:Variation
Returns the number of solutions that must be supplied to theevolve
method. -
evolve
Performs the crossover operation on two decision variables.- Parameters:
variable1
- the first variablevariable2
- the second variable
-