org.vizzini.ai.geneticalgorithm
Class ChromosomeNeuralNetwork

java.lang.Object
  extended by org.vizzini.ai.geneticalgorithm.AbstractChromosome
      extended by org.vizzini.ai.geneticalgorithm.ChromosomeDouble
          extended by org.vizzini.ai.geneticalgorithm.ChromosomeNeuralNetwork
All Implemented Interfaces:
Cloneable, Comparable, IChromosome

public class ChromosomeNeuralNetwork
extends ChromosomeDouble

Provides a chromosome which contains DefaultNeuralNetwork s.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Field Summary
 
Fields inherited from interface org.vizzini.ai.geneticalgorithm.IChromosome
UNKNOWN_FITNESS
 
Constructor Summary
ChromosomeNeuralNetwork(INeuralNetwork network)
          Construct this object using the given parameter.
 
Method Summary
static void chromosomeToNetwork(ChromosomeDouble chromosome, INeuralNetwork network)
          Set the neural network's weights from the chromosome.
static int computeSize(INeuralNetwork network)
          Compute the chromosome size based upon the given neural network.
 void copy(IChromosome another)
          Copy the given chromosome into this.
static int getIndex(INeuralNetwork network, int layerIndex, int i, int j)
          Return the gene index of the given neural network coordinates.
 INeuralNetwork getNeuralNetwork()
          Return the neural network.
 boolean isDirty()
          Return true if this chromosome is out of sync with the neural network.
static void networkToChromosome(INeuralNetwork network, ChromosomeDouble chromosome)
          Set the chromosome's genes from the neural network weights.
 void setFitnessUnknown()
          Set the fitness to unknown.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class org.vizzini.ai.geneticalgorithm.ChromosomeDouble
clone, equals, get, hashCode, mix, mix, mutate, randomlyInitialize, set, setRandomMax, setRandomMin, size, splice
 
Methods inherited from class org.vizzini.ai.geneticalgorithm.AbstractChromosome
addFitness, compareTo, getDescription, getFitness, isFitnessUnknown, setDescription, setFitness
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChromosomeNeuralNetwork

public ChromosomeNeuralNetwork(INeuralNetwork network)
Construct this object using the given parameter.

Since:
v0.1
Method Detail

chromosomeToNetwork

public static void chromosomeToNetwork(ChromosomeDouble chromosome,
                                       INeuralNetwork network)
Set the neural network's weights from the chromosome.

Since:
v0.1

computeSize

public static int computeSize(INeuralNetwork network)
Compute the chromosome size based upon the given neural network.

Since:
v0.1

getIndex

public static int getIndex(INeuralNetwork network,
                           int layerIndex,
                           int i,
                           int j)
Return the gene index of the given neural network coordinates.

Since:
v0.1

networkToChromosome

public static void networkToChromosome(INeuralNetwork network,
                                       ChromosomeDouble chromosome)
Set the chromosome's genes from the neural network weights.

Since:
v0.1

copy

public void copy(IChromosome another)
Copy the given chromosome into this. Extend the super method to clone the neural network.

Specified by:
copy in interface IChromosome
Overrides:
copy in class ChromosomeDouble
Since:
v0.1

getNeuralNetwork

public INeuralNetwork getNeuralNetwork()
Return the neural network.

Since:
v0.1

isDirty

public boolean isDirty()
Return true if this chromosome is out of sync with the neural network.

Since:
v0.1

setFitnessUnknown

public void setFitnessUnknown()
Set the fitness to unknown. Extend the super method to set the dirty flag.

Specified by:
setFitnessUnknown in interface IChromosome
Overrides:
setFitnessUnknown in class AbstractChromosome
Since:
v0.1

toString

public String toString()
Return a string representation of this object. Override the super method to avoid printing the genes.

Overrides:
toString in class ChromosomeDouble
Since:
v0.1


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02