org.encog.neural.neat.training.opp
Class NEATCrossover
- java.lang.Object
-
- org.encog.neural.neat.training.opp.NEATCrossover
-
- All Implemented Interfaces:
- java.io.Serializable, EvolutionaryOperator
public class NEATCrossover extends java.lang.Object implements EvolutionaryOperator, java.io.Serializable
Crossover is performed by mixing the link genes between the parents to produce an offspring. Only the link genes are considered for crossover. The neuron genes are chosen by virtue of which link genes were chosen. If a neuron gene is present in both parents, then we choose the neuron gene from the more fit of the two parents. For NEAT, it does not really matter what parent we get the neuron gene from. However, because HyperNEAT also encodes a unique activation function into the neuron, the selection of a neuron gene between two parents is more important. The crossover operator defines two broad classes of genes. Matching genes are those genes that are present in both parents. Non-matching genes are only present in one person. Non-matching genes are further divided into two more groups: disjoint genes: Genes in the middle of a genome that do not match between the parents. excess genes: Genes at the edge of a genome that do not match between the parents. Matching genes are inherited randomly, whereas disjoint genes (those that do not match in the middle) and excess genes (those that do not match in the end) are inherited from the more fit parent. In this case, equal fitnesses are assumed, so the disjoint and excess genes are also inherited randomly. The disabled genes may become enabled again in future generations: there is a preset chance that an inherited gene is disabled if it is disabled in either parent. This is implemented in this class via the following algorithm. First, create a counter for each parent. At each step in the loop, perform the following. If both parents have the same innovation number, then randomly choose which parent's gene to use. Increase the parent counter who contributed the gene. Else if one parent has a lower innovation number than the other, then include the lower innovation gene if its parent is the most fit. Increase the parent counter who contributed the gene. ----------------------------------------------------------------------------- http://www.cs.ucf.edu/~kstanley/ Encog's NEAT implementation was drawn from the following three Journal Articles. For more complete BibTeX sources, see NEATNetwork.java. Evolving Neural Networks Through Augmenting Topologies Generating Large-Scale Neural Networks Through Discovering Geometric Regularities Automatic feature selection in neuroevolution- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NEATCrossover()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddNeuronID(long nodeID, java.util.List<NEATNeuronGene> vec, NEATGenome best, NEATGenome notBest)Add a neuron.voidinit(EvolutionaryAlgorithm theOwner)Init this operator.intoffspringProduced()intparentsNeeded()voidperformOperation(java.util.Random rnd, Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex)Perform the evolutionary operation.
-
-
-
Method Detail
-
addNeuronID
public void addNeuronID(long nodeID, java.util.List<NEATNeuronGene> vec, NEATGenome best, NEATGenome notBest)Add a neuron.- Parameters:
nodeID- The ID.vec- The list of ID's used.best- The best node.notBest- Not the best node.
-
init
public void init(EvolutionaryAlgorithm theOwner)
Init this operator. This allows the EA to be defined.- Specified by:
initin interfaceEvolutionaryOperator- Parameters:
theOwner- The evolutionary algorithm used with this operator.
-
offspringProduced
public int offspringProduced()
- Specified by:
offspringProducedin interfaceEvolutionaryOperator- Returns:
- The number of offspring produced by this type of crossover.
-
parentsNeeded
public int parentsNeeded()
- Specified by:
parentsNeededin interfaceEvolutionaryOperator- Returns:
- The number of parents needed.
-
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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG