org.encog.ml.ea.population
Class BasicPopulation
- java.lang.Object
-
- org.encog.ml.BasicML
-
- org.encog.ml.ea.population.BasicPopulation
-
- All Implemented Interfaces:
- java.io.Serializable, Population, MLMethod, MLProperties
- Direct Known Subclasses:
- NEATPopulation, PrgPopulation
public class BasicPopulation extends BasicML implements Population, java.io.Serializable
Defines the basic functionality for a population of genomes. The population is made up of species. These species contain the individiual genomes that make up the population. If you do not want to use species, then create one species that holds every genome.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BasicPopulation()Construct an empty population.BasicPopulation(int thePopulationSize, GenomeFactory theGenomeFactory)Construct a population.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()Clear all genomes from this population.SpeciescreateSpecies()Create a species.SpeciesdetermineBestSpecies()Determine which species has the top genome.java.util.List<Genome>flatten()Flatten the species into a single list of genomes.GenomegetBestGenome()GenomeFactorygetGenomeFactory()intgetMaxIndividualSize()java.lang.StringgetName()intgetPopulationSize()RuleHoldergetRules()java.util.List<Species>getSpecies()voidpurgeInvalidGenomes()Purge any invalid genomes.voidsetBestGenome(Genome genome)Set the best genome.voidsetGenomeFactory(GenomeFactory factory)Set the gnome factory.voidsetName(java.lang.String theName)Set the name.voidsetPopulationSize(int thePopulationSize)Set the max population size.voidsetRules(RuleHolder rules)Set the rules holder to use.intsize()voidupdateProperties()Update any objeccts when a property changes.-
Methods inherited from class org.encog.ml.BasicML
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
-
-
-
-
Constructor Detail
-
BasicPopulation
public BasicPopulation()
Construct an empty population.
-
BasicPopulation
public BasicPopulation(int thePopulationSize, GenomeFactory theGenomeFactory)Construct a population.- Parameters:
thePopulationSize- The population size.theGenomeFactory- factory that can be used to store create genomes.
-
-
Method Detail
-
clear
public void clear()
Clear all genomes from this population.- Specified by:
clearin interfacePopulation
-
createSpecies
public Species createSpecies()
Create a species.- Specified by:
createSpeciesin interfacePopulation- Returns:
- The newly created species.
-
determineBestSpecies
public Species determineBestSpecies()
Determine which species has the top genome.- Specified by:
determineBestSpeciesin interfacePopulation- Returns:
- The species with the top genome.
-
flatten
public java.util.List<Genome> flatten()
Flatten the species into a single list of genomes.- Specified by:
flattenin interfacePopulation- Returns:
- The genomes that make up all species in the population.
-
getBestGenome
public Genome getBestGenome()
- Specified by:
getBestGenomein interfacePopulation- Returns:
- The best genome in the population.
-
getGenomeFactory
public GenomeFactory getGenomeFactory()
- Specified by:
getGenomeFactoryin interfacePopulation- Returns:
- A factory used to create genomes.
-
getMaxIndividualSize
public int getMaxIndividualSize()
- Specified by:
getMaxIndividualSizein interfacePopulation- Returns:
- The max size that an individual can become.
-
getName
public java.lang.String getName()
- Returns:
- The name.
-
getPopulationSize
public int getPopulationSize()
- Specified by:
getPopulationSizein interfacePopulation- Returns:
- The max population size.
-
getSpecies
public java.util.List<Species> getSpecies()
- Specified by:
getSpeciesin interfacePopulation- Returns:
- The species that make up the population.
-
setBestGenome
public void setBestGenome(Genome genome)
Set the best genome.- Specified by:
setBestGenomein interfacePopulation- Parameters:
genome- The best genome.
-
setGenomeFactory
public void setGenomeFactory(GenomeFactory factory)
Set the gnome factory.- Specified by:
setGenomeFactoryin interfacePopulation- Parameters:
factory- The genome factory.
-
setName
public void setName(java.lang.String theName)
Set the name.- Parameters:
theName- The new name.
-
setPopulationSize
public void setPopulationSize(int thePopulationSize)
Set the max population size.- Specified by:
setPopulationSizein interfacePopulation- Parameters:
thePopulationSize- The max population size.
-
size
public int size()
- Specified by:
sizein interfacePopulation- Returns:
- The size of the population.
-
updateProperties
public void updateProperties()
Update any objeccts when a property changes.- Specified by:
updatePropertiesin interfaceMLProperties- Specified by:
updatePropertiesin classBasicML
-
getRules
public RuleHolder getRules()
- Specified by:
getRulesin interfacePopulation- Returns:
- the rules
-
setRules
public void setRules(RuleHolder rules)
Description copied from interface:PopulationSet the rules holder to use.- Specified by:
setRulesin interfacePopulation- Parameters:
rules- the rules to set
-
purgeInvalidGenomes
public void purgeInvalidGenomes()
Purge any invalid genomes.- Specified by:
purgeInvalidGenomesin interfacePopulation
-
-
DMelt 3.0 © DataMelt by jWork.ORG