Documentation of 'org.encog.ml.prg.generator.AbstractPrgGenerator' Java class
AbstractPrgGenerator
org.encog.ml.prg.generator

Class AbstractPrgGenerator

    • Constructor Detail

      • AbstractPrgGenerator

        public AbstractPrgGenerator(EncogProgramContext theContext,
                                    int theMaxDepth)
        Construct the generator.
        Parameters:
        theContext - The context that is to be used for generation.
        theMaxDepth - The maximum depth to generate to.
    • Method Detail

      • addPopulationMember

        public void addPopulationMember(PrgPopulation population,
                                        EncogProgram prg)
        Add a population member from one of the threads.
        Parameters:
        population - The population to add to.
        prg - The program to add.
      • attemptCreateGenome

        public EncogProgram attemptCreateGenome(java.util.Random rnd,
                                                Population pop)
        Attempt to create a genome. Cycle the specified number of times if an error occurs.
        Parameters:
        rnd - The random number generator.
        pop - The population.
        Returns:
        The generated genome.
      • createRandomNode

        public ProgramNode createRandomNode(java.util.Random rnd,
                                            EncogProgram program,
                                            int depthRemaining,
                                            java.util.List<ValueType> types,
                                            boolean includeTerminal,
                                            boolean includeFunction)
        Create a random note according to the specified paramaters.
        Parameters:
        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.
        Returns:
        The generated program node.
      • createTerminalNode

        public ProgramNode createTerminalNode(java.util.Random rnd,
                                              EncogProgram program,
                                              java.util.List<ValueType> types)
        Create a terminal node.
        Parameters:
        rnd - A random number generator.
        program - The program to generate for.
        types - The types that we might generate.
        Returns:
        The terminal program node.
      • determineMaxDepth

        public int determineMaxDepth(java.util.Random rnd)
      • generate

        public EncogProgram generate(java.util.Random rnd)
        Generate a random genome.
        Specified by:
        generate in interface PopulationGenerator
        Parameters:
        rnd - A random number generator.
        Returns:
        A random genome.
      • generate

        public void generate(java.util.Random rnd,
                             Population pop)
        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(java.util.Random rnd,
                                                             java.util.List<ProgramExtensionTemplate> opcodes)
        Generate a random opcode.
        Parameters:
        rnd - Random number generator.
        opcodes - The opcodes to choose from.
        Returns:
        The selected opcode.
      • 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
      • 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
      • setMaxGenerationErrors

        public void setMaxGenerationErrors(int maxGenerationErrors)
        Description copied from interface: PrgGenerator
        Set the maximum errors to allow during generation.
        Specified by:
        setMaxGenerationErrors in interface PrgGenerator
        Parameters:
        maxGenerationErrors - the maxGenerationErrors 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.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.