org.encog.ml.genetic.genome
Class BasicGenome

java.lang.Object
  extended by org.encog.ml.genetic.genome.BasicGenome
All Implemented Interfaces:
Serializable, Comparable<Genome>, Genome
Direct Known Subclasses:
NEATGenome, NeuralGenome

public abstract class BasicGenome
extends Object
implements Genome, Serializable

A basic abstract genome. Provides base functionality.

See Also:
Serialized Form

Constructor Summary
BasicGenome()
           
 
Method Summary
 int calculateGeneCount()
           
 int compareTo(Genome other)
          
 boolean equals(Genome other)
          
 double getAdjustedScore()
          Get the adjusted score, this considers old-age penalties and youth bonuses.
 double getAmountToSpawn()
           
 List<Chromosome> getChromosomes()
           
 GeneticAlgorithm getGeneticAlgorithm()
           
 long getGenomeID()
           
 Object getOrganism()
           
 Population getPopulation()
           
 double getScore()
           
 void mate(Genome father, Genome child1, Genome child2)
          Mate two genomes.
 void setAdjustedScore(double theAdjustedScore)
          Set the adjusted score.
 void setAmountToSpawn(double theAmountToSpawn)
          Set the amount to spawn.
 void setGeneticAlgorithm(GeneticAlgorithm ga)
          Set the genetic algorithm to use.
 void setGenomeID(long theGenomeID)
          Set the genome id.
 void setOrganism(Object theOrganism)
          Set the organism.
 void setPopulation(Population thePopulation)
          Set the population that this genome belongs to.
 void setScore(double theScore)
          Set the score.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.encog.ml.genetic.genome.Genome
decode, encode
 

Constructor Detail

BasicGenome

public BasicGenome()
Method Detail

calculateGeneCount

public final int calculateGeneCount()
Specified by:
calculateGeneCount in interface Genome
Returns:
The number of genes in this genome.

equals

public boolean equals(Genome other)


compareTo

public final int compareTo(Genome other)

Specified by:
compareTo in interface Comparable<Genome>

getAdjustedScore

public final double getAdjustedScore()
Description copied from interface: Genome
Get the adjusted score, this considers old-age penalties and youth bonuses. If there are no such bonuses or penalties, this is the same as the score.

Specified by:
getAdjustedScore in interface Genome
Returns:
The adjusted score, which considers bonuses.

getAmountToSpawn

public final double getAmountToSpawn()
Specified by:
getAmountToSpawn in interface Genome
Returns:
The amount this genome will spawn.

getChromosomes

public final List<Chromosome> getChromosomes()
Specified by:
getChromosomes in interface Genome
Returns:
The number of chromosomes.

getGeneticAlgorithm

public final GeneticAlgorithm getGeneticAlgorithm()
Specified by:
getGeneticAlgorithm in interface Genome
Returns:
The genetic algorithm.

getGenomeID

public final long getGenomeID()
Specified by:
getGenomeID in interface Genome
Returns:
The genome id.

getOrganism

public final Object getOrganism()
Specified by:
getOrganism in interface Genome
Returns:
The organism produced.

getPopulation

public final Population getPopulation()
Specified by:
getPopulation in interface Genome
Returns:
the population

getScore

public final double getScore()
Specified by:
getScore in interface Genome
Returns:
The score.

mate

public final void mate(Genome father,
                       Genome child1,
                       Genome child2)
Mate two genomes. Will loop over all chromosomes.

Specified by:
mate in interface Genome
Parameters:
father - The father.
child1 - The first child.
child2 - The second child.

setAdjustedScore

public final void setAdjustedScore(double theAdjustedScore)
Set the adjusted score.

Specified by:
setAdjustedScore in interface Genome
Parameters:
theAdjustedScore - The score.

setAmountToSpawn

public final void setAmountToSpawn(double theAmountToSpawn)
Set the amount to spawn.

Specified by:
setAmountToSpawn in interface Genome
Parameters:
theAmountToSpawn - The amount to spawn.

setGeneticAlgorithm

public final void setGeneticAlgorithm(GeneticAlgorithm ga)
Set the genetic algorithm to use.

Specified by:
setGeneticAlgorithm in interface Genome
Parameters:
ga - The genetic algorithm to use.

setGenomeID

public final void setGenomeID(long theGenomeID)
Set the genome id.

Specified by:
setGenomeID in interface Genome
Parameters:
theGenomeID - the genome id.

setOrganism

public final void setOrganism(Object theOrganism)
Set the organism.

Parameters:
theOrganism - The organism.

setPopulation

public final void setPopulation(Population thePopulation)
Description copied from interface: Genome
Set the population that this genome belongs to.

Specified by:
setPopulation in interface Genome
Parameters:
thePopulation - the population to set

setScore

public final void setScore(double theScore)
Set the score.

Specified by:
setScore in interface Genome
Parameters:
theScore - Set the score.

toString

public final String toString()

Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.