org.encog.neural.neat.training
Class NEATGenome

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

public class NEATGenome
extends BasicGenome
implements Cloneable, Serializable

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/

See Also:
Serialized Form

Field Summary
static String PROPERTY_LINKS
           
static String PROPERTY_NEURONS
           
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()
           
NEATGenome(long genomeID, Chromosome neurons, Chromosome links, int inputCount, int outputCount)
          Create a NEAT gnome.
NEATGenome(long id, int inputCount, int outputCount)
          Construct a genome, do not provide links and neurons.
NEATGenome(NEATGenome other)
          Construct a genome by copying another.
 
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()
           
 Chromosome getLinksChromosome()
           
 int getNetworkDepth()
           
 Chromosome getNeurons()
           
 Chromosome getNeuronsChromosome()
           
 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 setInputCount(int inputCount)
           
 void setLinksChromosome(Chromosome linksChromosome)
           
 void setNetworkDepth(int networkDepth)
           
 void setNeuronsChromosome(Chromosome neuronsChromosome)
           
 void setOutputCount(int outputCount)
           
 void setSpeciesID(long species)
          Set the species id.
 void sortGenes()
          Sort the genes.
 
Methods inherited from class org.encog.ml.genetic.genome.BasicGenome
calculateGeneCount, compareTo, getAdjustedScore, getAmountToSpawn, getChromosomes, getGeneticAlgorithm, getGenomeID, getOrganism, getPopulation, getScore, mate, setAdjustedScore, setAmountToSpawn, setGeneticAlgorithm, setGenomeID, setOrganism, setPopulation, setScore, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_NEURONS

public static final String PROPERTY_NEURONS
See Also:
Constant Field Values

PROPERTY_LINKS

public static final String PROPERTY_LINKS
See Also:
Constant Field Values

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(NEATGenome other)
Construct a genome by copying another.

Parameters:
other - The other genome.

NEATGenome

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

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

NEATGenome

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

Parameters:
id - The genome id.
inputCount - The input count.
outputCount - The output count.

NEATGenome

public NEATGenome()
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.


getLinksChromosome

public Chromosome getLinksChromosome()
Returns:
the linksChromosome

setLinksChromosome

public void setLinksChromosome(Chromosome linksChromosome)
Parameters:
linksChromosome - the linksChromosome to set

getNeuronsChromosome

public Chromosome getNeuronsChromosome()
Returns:
the neuronsChromosome

setNeuronsChromosome

public void setNeuronsChromosome(Chromosome neuronsChromosome)
Parameters:
neuronsChromosome - the neuronsChromosome to set

setInputCount

public void setInputCount(int inputCount)
Parameters:
inputCount - the inputCount to set

setOutputCount

public void setOutputCount(int outputCount)
Parameters:
outputCount - the outputCount to set


Copyright © 2011. All Rights Reserved.