Package org.moeaframework.core.operator
Class OnePointCrossover
java.lang.Object
org.moeaframework.core.operator.OnePointCrossover
- All Implemented Interfaces:
Configurable
,Variation
One-point or single-point crossover. A crossover point is selected and all decision variables to the left/right
are swapped between the two parents. The two children resulting from this swapping are returned.
-
Constructor Summary
ConstructorDescriptionConstructs a one-point crossover operator with a 100% probability.OnePointCrossover
(double probability) Constructs a one-point crossover operator with the specified probability of applying this operator to solutions. -
Method Summary
Modifier and TypeMethodDescriptionSolution[]
Evolves one or more parent solutions (specified bygetArity
) and produces one or more child solutions.int
getArity()
Returns the number of solutions that must be supplied to theevolve
method.getName()
Returns the name of this variation operator.double
Returns the probability of applying this operator to solutions.void
setProbability
(double probability) Sets the probability of applying this operator to solutions.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
-
OnePointCrossover
public OnePointCrossover()Constructs a one-point crossover operator with a 100% probability. -
OnePointCrossover
public OnePointCrossover(double probability) Constructs a one-point crossover operator with the specified probability of applying this operator to solutions.- Parameters:
probability
- the probability of applying this operator to solutions
-
-
Method Details
-
getName
Description copied from interface:Variation
Returns the name of this variation operator. This name should also be used as the prefix for any parameters. As such, the name should only contain alphanumeric characters, avoid using whitespace and other symbols. -
getProbability
public double getProbability()Returns the probability of applying this operator to solutions.- Returns:
- the probability
-
setProbability
public void setProbability(double probability) Sets the probability of applying this operator to solutions.- 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.
-