|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
org.vizzini.ai.geneticprogramming.AbstractGeneticAlgorithmGP
public abstract class AbstractGeneticAlgorithmGP
Provides base functionality for a genetic programming genetic algorithm.
Field Summary |
---|
Fields inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm |
---|
_crossoverFraction, _crossoverType, _elapsedTime, _generation |
Constructor Summary | |
---|---|
AbstractGeneticAlgorithmGP()
Construct this object. |
Method Summary | |
---|---|
void |
addFunction(IFunction function)
Add a function exemplar to the function set. |
void |
addTerminal(ITerminal terminal)
Add a terminal exemplar to the terminal set. |
protected IChromosome |
createChromosome()
Create a new chromosome. |
protected void |
evaluateFitness()
Evaluate the fitnesses of the chromosomes in the population. |
protected abstract int |
evaluateFitness(int index,
IChromosomeGP chromosome,
boolean isPrinting)
Evaluate the fitness of the given chromosome for this problem. |
protected IContext |
getContext()
|
int |
getFunctionCount()
Return the function count. |
protected IFunctionGenerator |
getFunctionGenerator()
Return the function generator. |
protected int |
getInitialMaxDepth()
|
protected abstract Class |
getReturnType()
Return the overall return type for the chromosomes. |
int |
getTerminalCount()
Return the terminal count. |
boolean |
isSimpleBetter()
Return true if simpler (smaller) functions are better. |
protected void |
onePointCrossover(IChromosome c0_0,
IChromosome c1_0,
IChromosome c2_0,
IChromosome c3_0)
Perform one point crossover using the first two given chromosomes into the third given chromosome. |
protected void |
penalizeComplexity(IChromosomeGP chromosome,
int fitnessThreshold)
Penalize the given chromosome for complexity. |
protected void |
setContext(IContext context)
|
protected void |
setInitialMaxDepth(int initialMaxDepth)
|
void |
setSimpleBetter(boolean isSimpleBetter)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.vizzini.ai.geneticalgorithm.IGeneticAlgorithm |
---|
getCrossoverFraction, getCrossoverType, getElapsedTime, getGeneration, getMostFit, getMutationFraction, getMutationMagnitude, getMutationRate, getPopulationSize, getProcessingRate, reset, runGenerations, setAverageCrossoverFraction, setCrossoverFraction, setCrossoverType, setDuplicateAllowed, setMutationFraction, setMutationMagnitude, setMutationRate, setPopulationSize, writeReport |
Constructor Detail |
---|
public AbstractGeneticAlgorithmGP()
Method Detail |
---|
public void addFunction(IFunction function)
addFunction
in interface IGeneticAlgorithmGP
function
- Function exemplar.public void addTerminal(ITerminal terminal)
addTerminal
in interface IGeneticAlgorithmGP
terminal
- Terminal exemplar.public int getFunctionCount()
getFunctionCount
in interface IGeneticAlgorithmGP
public int getTerminalCount()
getTerminalCount
in interface IGeneticAlgorithmGP
public boolean isSimpleBetter()
public void setSimpleBetter(boolean isSimpleBetter)
isSimpleBetter
- the isSimpleBetter to setprotected abstract int evaluateFitness(int index, IChromosomeGP chromosome, boolean isPrinting)
chromosome
- Chromosome.isPrinting
- Flag indicating if the method should print.protected abstract Class getReturnType()
protected IChromosome createChromosome()
createChromosome
in class AbstractGeneticAlgorithm
protected void evaluateFitness()
evaluateFitness
in class AbstractGeneticAlgorithm
protected IContext getContext()
protected IFunctionGenerator getFunctionGenerator()
protected int getInitialMaxDepth()
protected void onePointCrossover(IChromosome c0_0, IChromosome c1_0, IChromosome c2_0, IChromosome c3_0)
onePointCrossover
in class AbstractGeneticAlgorithm
protected void penalizeComplexity(IChromosomeGP chromosome, int fitnessThreshold)
chromosome
- Chromosome to penalize.fitnessThreshold
- Fitness threshold which must be passed before a
penalty is applied.protected void setContext(IContext context)
context
- the context to setprotected void setInitialMaxDepth(int initialMaxDepth)
initialMaxDepth
- the initialMaxDepth to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |