org.encog.ml.ea.species
Class BasicSpecies

java.lang.Object
  extended by org.encog.ml.ea.species.BasicSpecies
All Implemented Interfaces:
Serializable, Species

public class BasicSpecies
extends Object
implements Serializable, Species

Provides basic functionality for a species.

See Also:
Serialized Form

Constructor Summary
BasicSpecies()
          Default constructor, used mainly for persistence.
BasicSpecies(Population thePopulation, Genome theFirst)
          Construct a species.
 
Method Summary
 void add(Genome genome)
          Add a genome to this species.
 double calculateShare(boolean shouldMinimize, double maxScore)
          Calculate this genome's share of the next population.
 int getAge()
          
 double getBestScore()
          
 int getGensNoImprovement()
          
 Genome getLeader()
          
 List<Genome> getMembers()
          
 int getOffspringCount()
          
 double getOffspringShare()
          
 Population getPopulation()
          
 void purge()
          Purge all members, increase age by one and count the number of generations with no improvement.
 void setAge(int theAge)
          Set the age of this species.
 void setBestScore(double theBestScore)
          Set the best score for this species.
 void setGensNoImprovement(int theGensNoImprovement)
          Set the number of generations with no improvement.
 void setLeader(Genome theLeader)
          Set the leader of this species.
 void setOffspringCount(int offspringCount)
          Set the offspring count.
 void setPopulation(Population thePopulation)
          Set the population.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicSpecies

public BasicSpecies()
Default constructor, used mainly for persistence.


BasicSpecies

public BasicSpecies(Population thePopulation,
                    Genome theFirst)
Construct a species.

Parameters:
thePopulation - The population the species belongs to.
theFirst - The first genome in the species.
Method Detail

add

public void add(Genome genome)
Add a genome to this species.

Specified by:
add in interface Species
Parameters:
genome - The genome to add.

calculateShare

public double calculateShare(boolean shouldMinimize,
                             double maxScore)
Calculate this genome's share of the next population.

Specified by:
calculateShare in interface Species
Parameters:
shouldMinimize - True if we see to minimize the score.
maxScore - The best score.
Returns:
The share of this species, as a percent ratio.

getAge

public int getAge()

Specified by:
getAge in interface Species
Returns:
The age of this species.

getBestScore

public double getBestScore()

Specified by:
getBestScore in interface Species
Returns:
The best score for this species.

getGensNoImprovement

public int getGensNoImprovement()

Specified by:
getGensNoImprovement in interface Species
Returns:
The number of generations with no imrpvement.

getLeader

public Genome getLeader()

Specified by:
getLeader in interface Species
Returns:
The leader of this species.

getMembers

public List<Genome> getMembers()

Specified by:
getMembers in interface Species
Returns:
The members of this species.

getOffspringCount

public int getOffspringCount()

Specified by:
getOffspringCount in interface Species
Returns:
Get the offspring count.

getOffspringShare

public double getOffspringShare()

Specified by:
getOffspringShare in interface Species
Returns:
The offspring share for the next iteration's population.

getPopulation

public Population getPopulation()

Specified by:
getPopulation in interface Species
Returns:
The population.

purge

public void purge()
Purge all members, increase age by one and count the number of generations with no improvement.


setAge

public void setAge(int theAge)
Set the age of this species.

Specified by:
setAge in interface Species
Parameters:
theAge - The age.

setBestScore

public void setBestScore(double theBestScore)
Set the best score for this species.

Specified by:
setBestScore in interface Species
Parameters:
theBestScore - The best score.

setGensNoImprovement

public void setGensNoImprovement(int theGensNoImprovement)
Set the number of generations with no improvement.

Specified by:
setGensNoImprovement in interface Species
Parameters:
theGensNoImprovement - The generation count with no improvement.

setLeader

public void setLeader(Genome theLeader)
Set the leader of this species.

Specified by:
setLeader in interface Species
Parameters:
theLeader - The leader.

setOffspringCount

public void setOffspringCount(int offspringCount)
Set the offspring count.

Specified by:
setOffspringCount in interface Species
Parameters:
offspringCount - The offspring count.

setPopulation

public void setPopulation(Population thePopulation)
Set the population.

Specified by:
setPopulation in interface Species
Parameters:
thePopulation - The population.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.