org.encog.solve.genetic.genome
Class BasicGenome

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

public abstract class BasicGenome
extends Object
implements Genome

A basic abstract genome. Provides base functionality.


Constructor Summary
BasicGenome(GeneticAlgorithm geneticAlgorithm)
          Construct a basic genome.
 
Method Summary
 int calculateGeneCount()
           
 int compareTo(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()
           
 double getScore()
           
 void mate(Genome father, Genome child1, Genome child2)
          Mate two genomes.
 void setAdjustedScore(double adjustedScore)
          Set the adjusted score.
 void setAmountToSpawn(double amountToSpawn)
          Set the amount to spawn.
 void setGeneticAlgorithm(GeneticAlgorithm ga)
          Set the genetic algorithm to use.
 void setGenomeID(long genomeID)
          Set the genome id.
 void setOrganism(Object organism)
          Set the organism.
 void setScore(double score)
          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.solve.genetic.genome.Genome
decode, encode
 

Constructor Detail

BasicGenome

public BasicGenome(GeneticAlgorithm geneticAlgorithm)
Construct a basic genome.

Parameters:
geneticAlgorithm -
Method Detail

calculateGeneCount

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

compareTo

public int compareTo(Genome other)

Specified by:
compareTo in interface Comparable<Genome>

getAdjustedScore

public 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 double getAmountToSpawn()
Specified by:
getAmountToSpawn in interface Genome
Returns:
The amount this genome will spawn.

getChromosomes

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

getGeneticAlgorithm

public GeneticAlgorithm getGeneticAlgorithm()
Returns:
The genetic algorithm.

getGenomeID

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

getOrganism

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

getScore

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

mate

public 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 void setAdjustedScore(double adjustedScore)
Set the adjusted score.

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

setAmountToSpawn

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

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

setGeneticAlgorithm

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

Parameters:
ga - The genetic algorithm to use.

setGenomeID

public void setGenomeID(long genomeID)
Set the genome id.

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

setOrganism

public void setOrganism(Object organism)
Set the organism.

Parameters:
organism - The organism.

setScore

public void setScore(double score)
Set the score.

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

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.