|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.encog.solve.genetic.GeneticAlgorithm<GENE_TYPE>
public abstract class GeneticAlgorithm<GENE_TYPE>
GeneticAlgorithm: Implements a genetic algorithm. This is an abstract class. Other classes are provided in this book that use this base class to train neural networks or provide an answer to the traveling salesman problem. The genetic algorithm is also capable of using a thread pool to speed execution.
| Field Summary | |
|---|---|
static int |
TIMEOUT
Threadpool timeout. |
| Constructor Summary | |
|---|---|
GeneticAlgorithm()
|
|
| Method Summary | |
|---|---|
Chromosome<GENE_TYPE> |
getChromosome(int i)
Get a specific chromosome. |
Chromosome<GENE_TYPE>[] |
getChromosomes()
Return the entire population. |
int |
getCutLength()
Get the cut length. |
double |
getMatingPopulation()
Get the mating population. |
double |
getMutationPercent()
Get the mutation percent. |
double |
getPercentToMate()
Get the percent to mate. |
java.util.concurrent.ExecutorService |
getPool()
Get the optional threadpool. |
int |
getPopulationSize()
Get the population size. |
boolean |
isPreventRepeat()
Should repeating genes be prevented. |
void |
iteration()
Modify the weight matrix and thresholds based on the last call to calcError. |
void |
setChromosome(int i,
Chromosome<GENE_TYPE> value)
Set the specified chromosome. |
void |
setChromosomes(Chromosome<GENE_TYPE>[] chromosomes)
Set the entire population. |
void |
setCutLength(int cutLength)
Set the cut length. |
void |
setMatingPopulation(double matingPopulation)
Set the mating population percent. |
void |
setMutationPercent(double mutationPercent)
Set the mutation percent. |
void |
setPercentToMate(double percentToMate)
Set the percent to mate. |
void |
setPool(java.util.concurrent.ExecutorService pool)
Set the optional thread pool. |
void |
setPopulationSize(int populationSize)
Set the population size. |
void |
setPreventRepeat(boolean preventRepeat)
Set the gene. |
void |
sortChromosomes()
Sort the chromosomes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int TIMEOUT
| Constructor Detail |
|---|
public GeneticAlgorithm()
| Method Detail |
|---|
public Chromosome<GENE_TYPE> getChromosome(int i)
i - The chromosome to return, 0 for the first one.
public Chromosome<GENE_TYPE>[] getChromosomes()
public int getCutLength()
public double getMatingPopulation()
public double getMutationPercent()
public double getPercentToMate()
public java.util.concurrent.ExecutorService getPool()
public int getPopulationSize()
public boolean isPreventRepeat()
public void iteration()
NeuralNetworkException
public void setChromosome(int i,
Chromosome<GENE_TYPE> value)
i - The chromosome to set.value - The value for the specified chromosome.public void setChromosomes(Chromosome<GENE_TYPE>[] chromosomes)
chromosomes - the chromosomes to setpublic void setCutLength(int cutLength)
cutLength - The cut length.public void setMatingPopulation(double matingPopulation)
matingPopulation - The mating population percent.public void setMutationPercent(double mutationPercent)
mutationPercent - The percent to mutate.public void setPercentToMate(double percentToMate)
percentToMate - The percent to mate.public void setPool(java.util.concurrent.ExecutorService pool)
pool - the pool to setpublic void setPopulationSize(int populationSize)
populationSize - The population size.public void setPreventRepeat(boolean preventRepeat)
preventRepeat - Should repeats be prevented.public void sortChromosomes()
|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||