org.encog.ml.prg.generator
public abstract class AbstractPrgGenerator extends Object implements PrgGenerator, MultiThreadable
Constructor and Description |
---|
AbstractPrgGenerator(EncogProgramContext theContext,
int theMaxDepth)
Construct the generator.
|
Modifier and Type | Method and Description |
---|---|
void |
addPopulationMember(PrgPopulation population,
EncogProgram prg)
Add a population member from one of the threads.
|
EncogProgram |
attemptCreateGenome(Random rnd,
Population pop)
Attempt to create a genome.
|
ProgramNode |
createRandomNode(Random rnd,
EncogProgram program,
int depthRemaining,
List<ValueType> types,
boolean includeTerminal,
boolean includeFunction)
Create a random note according to the specified paramaters.
|
ProgramNode |
createTerminalNode(Random rnd,
EncogProgram program,
List<ValueType> types)
Create a terminal node.
|
int |
determineMaxDepth(Random rnd) |
EncogProgram |
generate(Random rnd)
Generate a random genome.
|
void |
generate(Random rnd,
Population pop)
Generate a random population.
|
ProgramExtensionTemplate |
generateRandomOpcode(Random rnd,
List<ProgramExtensionTemplate> opcodes)
Generate a random opcode.
|
EncogProgramContext |
getContext() |
double |
getMaxConst() |
int |
getMaxDepth() |
int |
getMaxGenerationErrors() |
double |
getMinConst() |
RandomFactory |
getRandomFactory() |
CalculateScore |
getScore() |
int |
getThreadCount() |
boolean |
isHasEnum() |
void |
setMaxConst(double maxConst) |
void |
setMaxGenerationErrors(int maxGenerationErrors)
Set the maximum errors to allow during generation.
|
void |
setMinConst(double minConst) |
void |
setRandomFactory(RandomFactory randomFactory) |
void |
setScore(CalculateScore score) |
void |
setThreadCount(int numThreads)
Set the number of threads to use.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createNode
public AbstractPrgGenerator(EncogProgramContext theContext, int theMaxDepth)
theContext
- The context that is to be used for generation.theMaxDepth
- The maximum depth to generate to.public void addPopulationMember(PrgPopulation population, EncogProgram prg)
population
- The population to add to.prg
- The program to add.public EncogProgram attemptCreateGenome(Random rnd, Population pop)
rnd
- The random number generator.pop
- The population.public ProgramNode createRandomNode(Random rnd, EncogProgram program, int depthRemaining, List<ValueType> types, boolean includeTerminal, boolean includeFunction)
rnd
- A random number generator.program
- The program to generate for.depthRemaining
- The depth remaining to generate.types
- The types to generate.includeTerminal
- Should we include terminal nodes.includeFunction
- Should we include function nodes.public ProgramNode createTerminalNode(Random rnd, EncogProgram program, List<ValueType> types)
rnd
- A random number generator.program
- The program to generate for.types
- The types that we might generate.public int determineMaxDepth(Random rnd)
public EncogProgram generate(Random rnd)
generate
in interface PopulationGenerator
rnd
- A random number generator.public void generate(Random rnd, Population pop)
generate
in interface PopulationGenerator
rnd
- Random number generator.pop
- The population to generate into.public ProgramExtensionTemplate generateRandomOpcode(Random rnd, List<ProgramExtensionTemplate> opcodes)
rnd
- Random number generator.opcodes
- The opcodes to choose from.public EncogProgramContext getContext()
public double getMaxConst()
public int getMaxDepth()
public int getMaxGenerationErrors()
getMaxGenerationErrors
in interface PrgGenerator
public double getMinConst()
public RandomFactory getRandomFactory()
public CalculateScore getScore()
public int getThreadCount()
getThreadCount
in interface MultiThreadable
public boolean isHasEnum()
public void setMaxConst(double maxConst)
maxConst
- the maxConst to setpublic void setMaxGenerationErrors(int maxGenerationErrors)
PrgGenerator
setMaxGenerationErrors
in interface PrgGenerator
maxGenerationErrors
- the maxGenerationErrors to setpublic void setMinConst(double minConst)
minConst
- the minConst to setpublic void setRandomFactory(RandomFactory randomFactory)
randomFactory
- the randomFactory to setpublic void setScore(CalculateScore score)
score
- the score to setpublic void setThreadCount(int numThreads)
MultiThreadable
setThreadCount
in interface MultiThreadable
numThreads
- The desired thread count.Copyright © 2014. All Rights Reserved.