The Encog Project

org.encog.neural.networks.training.genetic
Class NeuralChromosome

java.lang.Object
  extended by org.encog.solve.genetic.Chromosome<java.lang.Double>
      extended by org.encog.neural.networks.training.genetic.NeuralChromosome
All Implemented Interfaces:
java.lang.Comparable<Chromosome<java.lang.Double>>
Direct Known Subclasses:
TrainingSetNeuralChromosome

public abstract class NeuralChromosome
extends Chromosome<java.lang.Double>

NeuralChromosome: Implements a chromosome that allows a feedforward neural network to be trained using a genetic algorithm. The chromosome for a feed forward neural network is the weight and threshold matrix. This class is abstract. If you wish to train the neural network using training sets, you should use the TrainingSetNeuralChromosome class. If you wish to use a cost function to train the neural network, then implement a subclass of this one that properly calculates the cost. The generic type GA_TYPE specifies the GeneticAlgorithm derived class that implements the genetic algorithm that this class is to be used with.


Constructor Summary
NeuralChromosome()
           
 
Method Summary
 BasicNetwork getNetwork()
           
 void initGenes(int length)
          Init the genes array.
 void mutate()
          Mutate this chromosome randomly.
 void setGenes(java.lang.Double[] list)
          Set all genes.
 void setNetwork(BasicNetwork network)
           
 void updateGenes()
          Copy the network to the genes.
 void updateNetwork()
          Copy the genes to the network.
 
Methods inherited from class org.encog.solve.genetic.Chromosome
calculateCost, compareTo, getCost, getGene, getGenes, getGeneticAlgorithm, mate, setCost, setGene, setGenesDirect, setGeneticAlgorithm, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeuralChromosome

public NeuralChromosome()
Method Detail

getNetwork

public BasicNetwork getNetwork()
Returns:
the network

initGenes

public void initGenes(int length)
Init the genes array.

Parameters:
length - The length to create.

mutate

public void mutate()
Mutate this chromosome randomly.

Specified by:
mutate in class Chromosome<java.lang.Double>

setGenes

public void setGenes(java.lang.Double[] list)
Set all genes.

Overrides:
setGenes in class Chromosome<java.lang.Double>
Parameters:
list - A list of genes.

setNetwork

public void setNetwork(BasicNetwork network)
Parameters:
network - the network to set

updateGenes

public void updateGenes()
Copy the network to the genes.


updateNetwork

public void updateNetwork()
Copy the genes to the network.


The Encog Project