org.encog.ml.prg.generator
Class AbstractGenerator

java.lang.Object
  extended by org.encog.ml.prg.generator.AbstractGenerator
All Implemented Interfaces:
PopulationGenerator, MultiThreadable
Direct Known Subclasses:
PrgGrowGenerator

public abstract class AbstractGenerator
extends Object
implements PopulationGenerator, MultiThreadable


Constructor Summary
AbstractGenerator(EncogProgramContext theContext, int theMaxDepth)
           
 
Method Summary
 void addPopulationMember(PrgPopulation population, EncogProgram prg)
           
 EncogProgram attemptCreateGenome(Random rnd, Population pop)
           
 ProgramNode createLeafNode(Random rnd, EncogProgram program)
           
abstract  ProgramNode createNode(Random rnd, EncogProgram program, int depth)
           
 EncogProgram generate(Random rnd)
          Generate a random genome.
 ProgramNode generate(Random rnd, EncogProgram program)
          Generate a new random branch that can be used with the specified program.
 void generate(Random rnd, Population pop)
          Generate a random population.
 ProgramExtensionTemplate generateRandomOpcode(Random rnd, List<ProgramExtensionTemplate> opcodes)
           
 EncogProgramContext getContext()
           
 List<ProgramExtensionTemplate> getLeaves()
           
 double getMaxConst()
           
 int getMaxDepth()
           
 double getMinConst()
           
 RandomFactory getRandomFactory()
           
 CalculateScore getScore()
           
 int getThreadCount()
           
 boolean isHasEnum()
           
 void setMaxConst(double maxConst)
           
 void setMinConst(double minConst)
           
 void setRandomFactory(RandomFactory randomFactory)
           
 void setScore(CalculateScore score)
           
 void setThreadCount(int numThreads)
          Set the number of threads to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGenerator

public AbstractGenerator(EncogProgramContext theContext,
                         int theMaxDepth)
Method Detail

addPopulationMember

public void addPopulationMember(PrgPopulation population,
                                EncogProgram prg)

attemptCreateGenome

public EncogProgram attemptCreateGenome(Random rnd,
                                        Population pop)

createLeafNode

public ProgramNode createLeafNode(Random rnd,
                                  EncogProgram program)

createNode

public abstract ProgramNode createNode(Random rnd,
                                       EncogProgram program,
                                       int depth)

generate

public EncogProgram generate(Random rnd)
Description copied from interface: PopulationGenerator
Generate a random genome.

Specified by:
generate in interface PopulationGenerator
Parameters:
rnd - A random number generator.
Returns:
A random genome.

generate

public ProgramNode generate(Random rnd,
                            EncogProgram program)
Generate a new random branch that can be used with the specified program. Does not actually attach the new branch anywhere.

Parameters:
rnd - Random number generator.
program - The program to generate a branch for.
Returns:
The new branch.

generate

public void generate(Random rnd,
                     Population pop)
Description copied from interface: PopulationGenerator
Generate a random population.

Specified by:
generate in interface PopulationGenerator
Parameters:
rnd - Random number generator.
pop - The population to generate into.

generateRandomOpcode

public ProgramExtensionTemplate generateRandomOpcode(Random rnd,
                                                     List<ProgramExtensionTemplate> opcodes)

getContext

public EncogProgramContext getContext()
Returns:
the context

getLeaves

public List<ProgramExtensionTemplate> getLeaves()
Returns:
the leaves

getMaxConst

public double getMaxConst()
Returns:
the maxConst

getMaxDepth

public int getMaxDepth()
Returns:
the maxDepth

getMinConst

public double getMinConst()
Returns:
the minConst

getRandomFactory

public RandomFactory getRandomFactory()
Returns:
the randomFactory

getScore

public CalculateScore getScore()
Returns:
the score

getThreadCount

public int getThreadCount()
Specified by:
getThreadCount in interface MultiThreadable
Returns:
The desired number of threads.

isHasEnum

public boolean isHasEnum()
Returns:
the hasEnum

setMaxConst

public void setMaxConst(double maxConst)
Parameters:
maxConst - the maxConst to set

setMinConst

public void setMinConst(double minConst)
Parameters:
minConst - the minConst to set

setRandomFactory

public void setRandomFactory(RandomFactory randomFactory)
Parameters:
randomFactory - the randomFactory to set

setScore

public void setScore(CalculateScore score)
Parameters:
score - the score to set

setThreadCount

public void setThreadCount(int numThreads)
Description copied from interface: MultiThreadable
Set the number of threads to use.

Specified by:
setThreadCount in interface MultiThreadable
Parameters:
numThreads - The desired thread count.


Copyright © 2013. All Rights Reserved.