org.encog.ml.ea.species
Class BasicSpecies
- java.lang.Object
-
- org.encog.ml.ea.species.BasicSpecies
-
- All Implemented Interfaces:
- java.io.Serializable, Species
public class BasicSpecies extends java.lang.Object implements java.io.Serializable, Species
Provides basic functionality for a species.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BasicSpecies()Default constructor, used mainly for persistence.BasicSpecies(Population thePopulation, Genome theFirst)Construct a species.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(Genome genome)Add a genome to this species.doublecalculateShare(boolean shouldMinimize, double maxScore)Calculate this genome's share of the next population.intgetAge()doublegetBestScore()intgetGensNoImprovement()GenomegetLeader()java.util.List<Genome>getMembers()intgetOffspringCount()doublegetOffspringShare()PopulationgetPopulation()voidpurge()Purge all members, increase age by one and count the number of generations with no improvement.voidsetAge(int theAge)Set the age of this species.voidsetBestScore(double theBestScore)Set the best score for this species.voidsetGensNoImprovement(int theGensNoImprovement)Set the number of generations with no improvement.voidsetLeader(Genome theLeader)Set the leader of this species.voidsetOffspringCount(int offspringCount)Set the offspring count.voidsetPopulation(Population thePopulation)Set the population.java.lang.StringtoString()
-
-
-
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.
-
calculateShare
public double calculateShare(boolean shouldMinimize, double maxScore)Calculate this genome's share of the next population.- Specified by:
calculateSharein interfaceSpecies- 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()
-
getBestScore
public double getBestScore()
- Specified by:
getBestScorein interfaceSpecies- Returns:
- The best score for this species.
-
getGensNoImprovement
public int getGensNoImprovement()
- Specified by:
getGensNoImprovementin interfaceSpecies- Returns:
- The number of generations with no imrpvement.
-
getLeader
public Genome getLeader()
-
getMembers
public java.util.List<Genome> getMembers()
- Specified by:
getMembersin interfaceSpecies- Returns:
- The members of this species.
-
getOffspringCount
public int getOffspringCount()
- Specified by:
getOffspringCountin interfaceSpecies- Returns:
- Get the offspring count.
-
getOffspringShare
public double getOffspringShare()
- Specified by:
getOffspringSharein interfaceSpecies- Returns:
- The offspring share for the next iteration's population.
-
getPopulation
public Population getPopulation()
- Specified by:
getPopulationin interfaceSpecies- 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.
-
setBestScore
public void setBestScore(double theBestScore)
Set the best score for this species.- Specified by:
setBestScorein interfaceSpecies- Parameters:
theBestScore- The best score.
-
setGensNoImprovement
public void setGensNoImprovement(int theGensNoImprovement)
Set the number of generations with no improvement.- Specified by:
setGensNoImprovementin interfaceSpecies- Parameters:
theGensNoImprovement- The generation count with no improvement.
-
setLeader
public void setLeader(Genome theLeader)
Set the leader of this species.
-
setOffspringCount
public void setOffspringCount(int offspringCount)
Set the offspring count.- Specified by:
setOffspringCountin interfaceSpecies- Parameters:
offspringCount- The offspring count.
-
setPopulation
public void setPopulation(Population thePopulation)
Set the population.- Specified by:
setPopulationin interfaceSpecies- Parameters:
thePopulation- The population.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG