org.encog.neural.neat.training.opp
Class NEATCrossover

java.lang.Object
  extended by org.encog.neural.neat.training.opp.NEATCrossover
All Implemented Interfaces:
EvolutionaryOperator

public class NEATCrossover
extends Object
implements EvolutionaryOperator

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


Constructor Summary
NEATCrossover()
           
 
Method Summary
 void addNeuronID(long nodeID, List<NEATNeuronGene> vec, NEATGenome best, NEATGenome notBest)
          Add a neuron.
 void init(EvolutionaryAlgorithm theOwner)
          Init this operator.
 int offspringProduced()
          
 int parentsNeeded()
          
 void performOperation(Random rnd, Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex)
          Perform the evolutionary operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NEATCrossover

public NEATCrossover()
Method Detail

addNeuronID

public void addNeuronID(long nodeID,
                        List<NEATNeuronGene> vec,
                        NEATGenome best,
                        NEATGenome notBest)
Add a neuron.

Parameters:
nodeID - The neuron id.
vec - THe list of id's used.

init

public void init(EvolutionaryAlgorithm theOwner)
Init this operator. This allows the EA to be defined.

Specified by:
init in interface EvolutionaryOperator
Parameters:
theOwner - The evolutionary algorithm used with this operator.

offspringProduced

public int offspringProduced()

Specified by:
offspringProduced in interface EvolutionaryOperator
Returns:
The number of offspring produced by this type of crossover.

parentsNeeded

public int parentsNeeded()

Specified by:
parentsNeeded in interface EvolutionaryOperator
Returns:
The number of parents needed.

performOperation

public void performOperation(Random rnd,
                             Genome[] parents,
                             int parentIndex,
                             Genome[] offspring,
                             int offspringIndex)
Perform the evolutionary operation.

Specified by:
performOperation in interface EvolutionaryOperator
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.


Copyright © 2014. All Rights Reserved.