public class JEvolution
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
generationCount
The number of currently completed generations.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChromosome(Chromosome chromosome)
Add a JEvolution native or a custom Chromosome to the Genotype.
|
boolean |
doesMaximization()
Returns status of optimization.
|
void |
doEvolve()
The evolutionary cycle.
|
int |
doEvolve(int stepGenerations)
Runs JEvolution for the specified number of generations.
|
java.util.Comparator |
getFitnessComparator()
Returns the fitness comparator.
|
double |
getFitnessThreshold()
Gives the fitness threshold of this evolutionary cycle.
|
boolean |
getFreezer()
Gets the freezing state of the population.
|
java.util.List<Chromosome> |
getGenotypeModel()
Returns the genotype used by JEvolution.
|
static JEvolution |
getInstance()
Returns the singleton.
|
JEvolutionReporter |
getJEvolutionReporter()
Access statistics.
|
evSOLve.JEvolution.Population |
getLastPopulation()
Returns the current (last) population.
|
int |
getMaximalGenerations()
Gives maximal number of generations.
|
int |
getMinimalGenerations()
Gives minimal number of generations.
|
int |
getOffspringCount()
Returns the number of offspring.
|
int |
getParentCount()
Returns the number of parents.
|
SubPopulation |
getSeedPopulation()
Returns the seedPopulation (may be empty).
|
double |
getShuffleRate()
Returns the shuffle rate.
|
void |
recordPopulation(java.lang.String fileName)
Deprecated.
|
void |
restorePopulation(java.lang.String fileName)
Deprecated.
|
void |
setFitnessThreshold(double fitnessThreshold)
Changes the fitness threshold.
|
void |
setFreezer(boolean freeze)
Freezes the population starting with the next generation.
|
void |
setMaximalGenerations(int maximalGenerations)
Changes maximal number of generations.
|
void |
setMaximization(boolean maximization)
Sets status of optimization.
|
void |
setMinimalGenerations(int minimalGenerations)
Changes minimal number of generations.
|
void |
setPhenotype(Phenotype phenotype)
Set the Phenotype with all the problem-specific code.
|
void |
setPopulationSize(int populationSize)
Changes population sizes.
|
void |
setPopulationSize(int parentCount,
int offspringCount)
Changes population sizes.
|
void |
setSeedPopulation(SubPopulation seedPopulation)
Sets seed population.
|
void |
setSelection(Selection selection)
Set Selection type.
|
void |
setShuffleRate(double shuffleRate)
Sets the shuffle rate.
|
void |
setSubPopulations(int subPopulationCount)
Sets the number of sub-populations (default = 1).
|
protected int generationCount
public static JEvolution getInstance()
public void doEvolve()
public int doEvolve(int stepGenerations)
doEvolve()public void addChromosome(Chromosome chromosome)
chromosome - JEvolution native or costum ChromosomePhenotype.doOntogeny(java.util.List<evSOLve.JEvolution.chromosomes.Chromosome>),
setShuffleRate(double)public java.util.List<Chromosome> getGenotypeModel()
addChromosome(evSOLve.JEvolution.chromosomes.Chromosome)public void setPhenotype(Phenotype phenotype)
phenotype - Fitness code provided by user.public void setSelection(Selection selection)
selection - native or custom selection methodpublic int getParentCount()
public int getOffspringCount()
public void setSubPopulations(int subPopulationCount)
throws JEvolutionException
subPopulationCount - number of sub-populationsJEvolutionException - count < 1public void setPopulationSize(int populationSize)
throws JEvolutionException
populationSize - number of parents = number of offspringJEvolutionException - size < 0public void setPopulationSize(int parentCount,
int offspringCount)
throws JEvolutionException
parentCount - the number of parents (mu in ES)offspringCount - the number of offspring (lambda in ES)JEvolutionException - count < 0public evSOLve.JEvolution.Population getLastPopulation()
Population.getIndividual(int),
Individual.toFile(java.lang.String)public SubPopulation getSeedPopulation()
SubPopulation.addIndividual(evSOLve.JEvolution.Individual)public void setSeedPopulation(SubPopulation seedPopulation)
seedPopulation - subpopulation of seed individualsSubPopulation.addIndividual(evSOLve.JEvolution.Individual)public void recordPopulation(java.lang.String fileName)
throws java.io.IOException
fileName - name of the file whereto the current population is writtenjava.io.FileNotFoundExceptionjava.io.IOExceptionPopulation.getIndividual(int),
Individual.toFile(java.lang.String)public void restorePopulation(java.lang.String fileName)
throws java.io.IOException,
java.lang.ClassNotFoundException
fileName - name of the file to restore the population fromjava.io.FileNotFoundExceptionjava.io.IOExceptionjava.lang.ClassNotFoundExceptionIndividual.Individual(java.lang.String)public void setFreezer(boolean freeze)
freeze - true, if population to be frozenpublic boolean getFreezer()
public int getMaximalGenerations()
public void setMaximalGenerations(int maximalGenerations)
throws JEvolutionException
maximalGenerations - generations per runJEvolutionException - meaningless numberpublic int getMinimalGenerations()
public void setMinimalGenerations(int minimalGenerations)
throws JEvolutionException
minimalGenerations - minimal generations per run (default 0)JEvolutionException - meaningless numberpublic double getFitnessThreshold()
setMinimalGenerations(int)public void setFitnessThreshold(double fitnessThreshold)
fitnessThreshold - the fitness value to terminate evolutionsetMinimalGenerations(int)public java.util.Comparator getFitnessComparator()
public double getShuffleRate()
public void setShuffleRate(double shuffleRate)
shuffleRate - the probability to shuffle homologous chromosomesaddChromosome(evSOLve.JEvolution.chromosomes.Chromosome)public boolean doesMaximization()
public void setMaximization(boolean maximization)
maximization - true, if maximizationpublic JEvolutionReporter getJEvolutionReporter()