org.encog.neural.networks.training.neat
Class NEATGenome

java.lang.Object
  extended by org.encog.solve.genetic.genome.BasicGenome
      extended by org.encog.neural.networks.training.neat.NEATGenome
All Implemented Interfaces:
Cloneable, Comparable<Genome>, Genome

public class NEATGenome
extends BasicGenome
implements Cloneable

Implements a NEAT genome. This is a "blueprint" for creating a neural network. NeuroEvolution of Augmenting Topologies (NEAT) is a genetic algorithm for the generation of evolving artificial neural networks. It was developed by Ken Stanley while at The University of Texas at Austin. http://www.cs.ucf.edu/~kstanley/


Field Summary
static double TWEAK_DISJOINT
          The adjustment factor for disjoint genes.
static double TWEAK_EXCESS
          The adjustment factor for excess genes.
static double TWEAK_MATCHED
          The adjustment factor for matched genes.
 
Constructor Summary
NEATGenome()
          Default constructor, used mainly for persistence.
NEATGenome(NEATGenome other)
          Construct a genome by copying another.
NEATGenome(NEATTraining training, long genomeID, Chromosome neurons, Chromosome links, int inputCount, int outputCount)
          Create a NEAT gnome.
NEATGenome(NEATTraining training, long id, int inputCount, int outputCount)
          Construct a genome, do not provide links and neurons.
 
Method Summary
 boolean alreadyHaveThisNeuronID(long id)
          Do we already have this neuron id?
 void decode()
          Convert the genes to an actual network.
 void encode()
          Convert the network to genes.
 double getCompatibilityScore(NEATGenome genome)
          Get the compatibility score with another genome.
 int getInputCount()
           
 Chromosome getLinks()
           
 int getNetworkDepth()
           
 Chromosome getNeurons()
           
 int getNumGenes()
           
 int getOutputCount()
           
 long getSpeciesID()
           
 double getSplitY(int nd)
          Get the specified split y.
 boolean isDuplicateLink(long fromNeuronID, long toNeuronID)
          Determine if this is a duplicate link.
 void mutateActivationResponse(double mutateRate, double maxPertubation)
          Mutate the activation response.
 void mutateWeights(double mutateRate, double probNewMutate, double maxPertubation)
          Mutate the weights.
 void setNetworkDepth(int networkDepth)
           
 void setSpeciesID(long species)
          Set the species id.
 void sortGenes()
          Sort the genes.
 String toString()
          
 
Methods inherited from class org.encog.solve.genetic.genome.BasicGenome
calculateGeneCount, compareTo, getAdjustedScore, getAmountToSpawn, getChromosomes, getGeneticAlgorithm, getGenomeID, getOrganism, getScore, mate, setAdjustedScore, setAmountToSpawn, setGeneticAlgorithm, setGenomeID, setOrganism, setScore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TWEAK_DISJOINT

public static final double TWEAK_DISJOINT
The adjustment factor for disjoint genes.

See Also:
Constant Field Values

TWEAK_EXCESS

public static final double TWEAK_EXCESS
The adjustment factor for excess genes.

See Also:
Constant Field Values

TWEAK_MATCHED

public static final double TWEAK_MATCHED
The adjustment factor for matched genes.

See Also:
Constant Field Values
Constructor Detail

NEATGenome

public NEATGenome()
Default constructor, used mainly for persistence.


NEATGenome

public NEATGenome(NEATGenome other)
Construct a genome by copying another.

Parameters:
other - The other genome.

NEATGenome

public NEATGenome(NEATTraining training,
                  long genomeID,
                  Chromosome neurons,
                  Chromosome links,
                  int inputCount,
                  int outputCount)
Create a NEAT gnome.

Parameters:
training - The owner object.
genomeID - The genome id.
neurons - The neurons.
links - The links.
inputCount - The input count.
outputCount - The output count.

NEATGenome

public NEATGenome(NEATTraining training,
                  long id,
                  int inputCount,
                  int outputCount)
Construct a genome, do not provide links and neurons.

Parameters:
training - The owner object.
id - The genome id.
inputCount - The input count.
outputCount - The output count.
Method Detail

alreadyHaveThisNeuronID

public boolean alreadyHaveThisNeuronID(long id)
Do we already have this neuron id?

Parameters:
id - The id to check for.
Returns:
True if we already have this neuron id.

decode

public void decode()
Convert the genes to an actual network.

Specified by:
decode in interface Genome

encode

public void encode()
Convert the network to genes. Not currently supported.

Specified by:
encode in interface Genome

getCompatibilityScore

public double getCompatibilityScore(NEATGenome genome)
Get the compatibility score with another genome. Used to determine species.

Parameters:
genome - The other genome.
Returns:
The score.

getInputCount

public int getInputCount()
Returns:
The number of input neurons.

getLinks

public Chromosome getLinks()
Returns:
THe links chromosome.

getNetworkDepth

public int getNetworkDepth()
Returns:
The network depth.

getNeurons

public Chromosome getNeurons()
Returns:
The neurons chromosome.

getNumGenes

public int getNumGenes()
Returns:
The number of genes in the links chromosome.

getOutputCount

public int getOutputCount()
Returns:
The output count.

getSpeciesID

public long getSpeciesID()
Returns:
The species ID.

getSplitY

public double getSplitY(int nd)
Get the specified split y.

Parameters:
nd - The neuron.
Returns:
The split y.

isDuplicateLink

public boolean isDuplicateLink(long fromNeuronID,
                               long toNeuronID)
Determine if this is a duplicate link.

Parameters:
fromNeuronID - The from neuron id.
toNeuronID - The to neuron id.
Returns:
True if this is a duplicate link.

mutateActivationResponse

public void mutateActivationResponse(double mutateRate,
                                     double maxPertubation)
Mutate the activation response.

Parameters:
mutateRate - The mutation rate.
maxPertubation - The maximum to perturb it by.

mutateWeights

public void mutateWeights(double mutateRate,
                          double probNewMutate,
                          double maxPertubation)
Mutate the weights.

Parameters:
mutateRate - The mutation rate.
probNewMutate - The probability of a whole new weight.
maxPertubation - The max perturbation.

setNetworkDepth

public void setNetworkDepth(int networkDepth)
Parameters:
networkDepth - the networkDepth to set

setSpeciesID

public void setSpeciesID(long species)
Set the species id.

Parameters:
species - The species id.

sortGenes

public void sortGenes()
Sort the genes.


toString

public String toString()

Overrides:
toString in class BasicGenome


Copyright © 2011. All Rights Reserved.