org.encog.ml.genetic.crossover
Class SpliceNoRepeat
- java.lang.Object
-
- org.encog.ml.genetic.crossover.SpliceNoRepeat
-
- All Implemented Interfaces:
- EvolutionaryOperator
public class SpliceNoRepeat extends java.lang.Object implements EvolutionaryOperator
A simple cross over where genes are simply "spliced". Genes are not allowed to repeat. This method only works with IntegerArrayGenome.
-
-
Constructor Summary
Constructors Constructor and Description SpliceNoRepeat(int theCutLength)Construct a splice crossover.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidinit(EvolutionaryAlgorithm theOwner)Called to setup the evolutionary operator.intoffspringProduced()intparentsNeeded()voidperformOperation(java.util.Random rnd, Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex)Perform the evolutionary operation.
-
-
-
Constructor Detail
-
SpliceNoRepeat
public SpliceNoRepeat(int theCutLength)
Construct a splice crossover.- Parameters:
theCutLength- The cut length.
-
-
Method Detail
-
performOperation
public void performOperation(java.util.Random rnd, Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex)Perform the evolutionary operation.- Specified by:
performOperationin interfaceEvolutionaryOperator- Parameters:
rnd- A random number generator.parents- The parents.parentIndex- The index into the parents array.offspring- The offspring.offspringIndex- An index into the offspring array.
-
offspringProduced
public int offspringProduced()
- Specified by:
offspringProducedin interfaceEvolutionaryOperator- Returns:
- The number of offspring produced, which is 2 for splice crossover.
-
parentsNeeded
public int parentsNeeded()
- Specified by:
parentsNeededin interfaceEvolutionaryOperator- Returns:
- The number of parents needed.
-
init
public void init(EvolutionaryAlgorithm theOwner)
Called to setup the evolutionary operator.- Specified by:
initin interfaceEvolutionaryOperator- Parameters:
theOwner- The evolutionary algorithm used with this operator.
-
-
DMelt 3.0 © DataMelt by jWork.ORG