Documentation of 'org.jgap.gp.impl.GPConfiguration' Java class
GPConfiguration
org.jgap.gp.impl

Class GPConfiguration

    • Method Detail

      • setGPFitnessEvaluator

        public void setGPFitnessEvaluator(IGPFitnessEvaluator a_evaluator)
        Sets a GP fitness evaluator, such as org.jgap.gp.impl.DefaultGPFitnessEvaluator.
        Parameters:
        a_evaluator - the fitness evaluator to set
        Since:
        3.1
      • setSelectionMethod

        public void setSelectionMethod(INaturalGPSelector a_method)
        Sets the selection method to use.
        Parameters:
        a_method - the selection method to use
        Since:
        3.1
      • setCrossoverMethod

        public void setCrossoverMethod(CrossMethod a_method)
        Sets the crossover method to use.
        Parameters:
        a_method - the crossover method to use
        Since:
        3.1
      • verifyStateIsValid

        public void verifyStateIsValid()
                                throws InvalidConfigurationException
        Description copied from class: Configuration
        Tests the state of this Configuration object to make sure it's valid. This generally consists of verifying that required settings have, in fact, been set. If this object is not in a valid state, then an exception will be thrown detailing the reason the state is not valid.
        Overrides:
        verifyStateIsValid in class Configuration
        Throws:
        InvalidConfigurationException - if the state of this Configuration is not valid. The error message in the exception will detail the reason for invalidity
      • addGeneticOperator

        public void addGeneticOperator(GeneticOperator a_operatorToAdd)
                                throws InvalidConfigurationException
        Description copied from class: Configuration
        Adds a genetic operator for use in this algorithm. Genetic operators represent evolutionary steps that, when combined, make up the evolutionary process. Examples of genetic operators are reproduction, crossover, and mutation. During the evolution process, all of the genetic operators added via this method are invoked in the order they were added. At least one genetic operator must be provided.
        Overrides:
        addGeneticOperator in class Configuration
        Parameters:
        a_operatorToAdd - the genetic operator to add.
        Throws:
        InvalidConfigurationException - if the genetic operator is null or if this Configuration object is locked
      • getCrossoverProb

        public double getCrossoverProb()
      • setCrossoverProb

        public void setCrossoverProb(float a_crossoverProb)
      • getReproductionProb

        public double getReproductionProb()
      • setReproductionProb

        public void setReproductionProb(float a_reproductionProb)
      • getMutationProb

        public double getMutationProb()
        Returns:
        probability for mutation of a node during growing a program
        Since:
        3.3.1
      • setMutationProb

        public void setMutationProb(float a_mutationProb)
        Parameters:
        a_mutationProb - probability for mutation of a node during growing a program
        Since:
        3.3.1
      • getDynamizeArityProb

        public double getDynamizeArityProb()
        Returns:
        probability for dynamizing the arity of a node during growing a program
        Since:
        3.4
      • setDynamizeArityProb

        public void setDynamizeArityProb(float a_dynArityProb)
        Parameters:
        a_dynArityProb - probability for dynamizing the arity of a node during growing a program
        Since:
        3.4
      • setFunctionProb

        public void setFunctionProb(double a_functionProb)
        Parameters:
        a_functionProb - probability that a function instead of a terminal is chosen in crossing over (between 0 and 1)
        Since:
        3.2
      • getFunctionProb

        public double getFunctionProb()
        Returns:
        probability that a function instead of a terminal is chosen in crossing over
        Since:
        3.2
      • setNewChromsPercent

        public void setNewChromsPercent(double a_newChromsPercent)
      • getNewChromsPercent

        public double getNewChromsPercent()
      • getMaxCrossoverDepth

        public int getMaxCrossoverDepth()
      • setMaxCrossoverDepth

        public void setMaxCrossoverDepth(int a_maxCrossoverDepth)
      • getMaxInitDepth

        public int getMaxInitDepth()
      • setMaxInitDepth

        public void setMaxInitDepth(int a_maxDepth)
      • getMinInitDepth

        public int getMinInitDepth()
      • setMinInitDepth

        public void setMinInitDepth(int a_minDepth)
      • pushToStack

        public void pushToStack(java.lang.Object a_value)
      • popFromStack

        public java.lang.Object popFromStack()
      • peekStack

        public java.lang.Object peekStack()
      • stackSize

        public int stackSize()
      • clearStack

        public void clearStack()
      • storeInMemory

        public void storeInMemory(java.lang.String a_name,
                                  java.lang.Object a_value)
        Stores a value in the internal memory.
        Parameters:
        a_name - named index of the memory cell
        a_value - the value to store
        Since:
        3.0
      • createMatrix

        public void createMatrix(java.lang.String a_name,
                                 int a_cols,
                                 int a_rows)
        Creates an instance of a matrix with a unique name.
        Parameters:
        a_name - the name of the matrix
        a_cols - number of columns the matrix should have
        a_rows - number of rows the matrix should have
        Since:
        3.4.3
      • setMatrix

        public void setMatrix(java.lang.String a_name,
                              int a_col,
                              int a_row,
                              char a_value)
        Sets a matrix field with a value.
        Parameters:
        a_name - the name of the matrix
        a_col - column in the matrix
        a_row - row in the matrix
        a_value - the value to set in the matrix at given column and row
        Since:
        3.4.3
      • resetMatrix

        public void resetMatrix(java.lang.String a_name,
                                char a_filler)
        Resets the matrix by filling it with a given character.
        Parameters:
        a_name - the name of the matrix
        a_filler - the character to fill the whole matrix with
        Since:
        3.4.3
      • readMatrix

        public char readMatrix(java.lang.String a_name,
                               int a_col,
                               int a_row)
        Reads a matrix cell and returns the value.
        Parameters:
        a_name - the name of the matrix
        a_col - the column to read
        a_row - the row to read
        Returns:
        the value in the matrix
        Since:
        3.4.3
      • getMatrix

        public char[][] getMatrix(java.lang.String a_name)
        Retrieves a named matrix.
        Parameters:
        a_name - the name of the matrix
        Returns:
        the matrix itself
        Since:
        3.4.3
      • storeMatrixMemory

        public CultureMemoryCell storeMatrixMemory(int a_x,
                                                   int a_y,
                                                   java.lang.Object a_value)
        Stores a value in the internal matrix memory.
        Parameters:
        a_x - the first coordinate of the matrix (width)
        a_y - the second coordinate of the matrix (height)
        a_value - the value to store
        Returns:
        created or used memory cell
        Since:
        3.2
      • readMatrixMemory

        public java.lang.Object readMatrixMemory(int a_x,
                                                 int a_y)
        Reads a value from the internal matrix memory.
        Parameters:
        a_x - the first coordinate of the matrix (width)
        a_y - the second coordinate of the matrix (height)
        Returns:
        read value
        Since:
        3.2
      • readFromMemory

        public java.lang.Object readFromMemory(java.lang.String a_name)
        Reads a value from the internal memory.
        Parameters:
        a_name - named index of the memory cell to read out
        Returns:
        read value
        Since:
        3.0
      • readFromMemoryIfExists

        public java.lang.Object readFromMemoryIfExists(java.lang.String a_name)
        Parameters:
        a_name - the name of the cell to evaluate
        Returns:
        the value of a memory cell, if it exsists. Otherwise returns null.
        Since:
        3.2
      • storeIndexedMemory

        public CultureMemoryCell storeIndexedMemory(int a_index,
                                                    java.lang.Object a_value)
        Stores a value in the internal indexed memory.
        Parameters:
        a_index - index of the cell
        a_value - the value to store
        Returns:
        created or used memory cell
        Since:
        3.2
      • readIndexedMemory

        public java.lang.Object readIndexedMemory(int a_index)
        Reads a value from the internal indexed memory.
        Parameters:
        a_index - index of the cell
        Returns:
        read value (maybe null )
        Since:
        3.2
      • clearMemory

        public void clearMemory()
        Clears the memory.
        Since:
        3.0
      • setFitnessEvaluator

        public void setFitnessEvaluator(IGPFitnessEvaluator a_fitnessEvaluator)
        Set the fitness evaluator (deciding if a given fitness value is better when it's higher or better when it's lower).
        Parameters:
        a_fitnessEvaluator - the FitnessEvaluator to be used
        Since:
        3.3.3
      • setFitnessFunction

        public void setFitnessFunction(GPFitnessFunction a_functionToSet)
                                throws InvalidConfigurationException
        Sets the fitness function to be used for this genetic algorithm. The fitness function is responsible for evaluating a given Chromosome and returning a positive integer that represents its worth as a candidate solution. These values are used as a guide by the natural to determine which Chromosome instances will be allowed to move on to the next round of evolution, and which will instead be eliminated.
        Parameters:
        a_functionToSet - fitness function to be used
        Throws:
        InvalidConfigurationException - if the fitness function is null, or if this Configuration object is locked.
        Since:
        1.1
      • isStrictProgramCreation

        public boolean isStrictProgramCreation()
        Returns:
        true: throw an error during evolution in case a situation is detected where no function or terminal of a required type is declared in the GPConfiguration; false: don't throw an error but try a completely different combination of functions and terminals
      • setStrictProgramCreation

        public void setStrictProgramCreation(boolean a_strict)
        Parameters:
        a_strict - true: throw an error during evolution in case a situation is detected where no function or terminal of a required type is declared in the GPConfiguration; false: don't throw an error but try a completely different combination of functions and terminals
      • getProgramCreationMaxtries

        public int getProgramCreationMaxtries()
      • setProgramCreationMaxTries

        public void setProgramCreationMaxTries(int a_maxtries)
      • getGPFitnessEvaluator

        public IGPFitnessEvaluator getGPFitnessEvaluator()
        Returns:
        the fitness evaluator set
        Since:
        3.0
      • validateNode

        public boolean validateNode(ProgramChromosome a_chrom,
                                    CommandGene a_node,
                                    CommandGene a_rootNode,
                                    int a_tries,
                                    int a_num,
                                    int a_recurseLevel,
                                    java.lang.Class a_type,
                                    CommandGene[] a_functionSet,
                                    int a_depth,
                                    boolean a_grow,
                                    int a_childIndex,
                                    boolean a_fullProgram)
        Validates a_node in the context of a_chrom. Considers the recursion level (a_recursLevel), the type needed (a_type) for the node, the functions available (a_functionSet) and the depth of the whole chromosome needed (a_depth), and whether grow mode is used (a_grow is true) or not.
        Parameters:
        a_chrom - the chromosome that will contain the node, if valid
        a_node - the node selected and to be validated
        a_rootNode - root node of the node to be validated (may be null)
        a_tries - number of times the validator has been called, useful for stopping by returning true if the number exceeds a limit
        a_num - the chromosome's index in the individual of this chromosome
        a_recurseLevel - level of recursion
        a_type - the return type of the node needed
        a_functionSet - the array of available functions
        a_depth - the needed depth of the program chromosome
        a_grow - true: use grow mode, false: use full mode
        a_childIndex - index of the child in the parent node to which it belongs (-1 if node is root node)
        a_fullProgram - true: whole program is available in a_chrom
        Returns:
        true: node is valid; false: node is invalid
        Since:
        3.0
      • setNodeValidator

        public void setNodeValidator(INodeValidator a_nodeValidator)
        Sets the node validator. Also see method validateNode.
        Parameters:
        a_nodeValidator - sic
        Since:
        3.0
      • getNodeValidator

        public INodeValidator getNodeValidator()
        Returns:
        the node validator set
        Since:
        3.0
      • equals

        public boolean equals(java.lang.Object a_other)
        Compares this entity against the specified object.
        Overrides:
        equals in class Configuration
        Parameters:
        a_other - the object to compare against
        Returns:
        true: if the objects are the same, false otherwise
        Since:
        3.1
      • compareTo

        public int compareTo(java.lang.Object a_other)
        Description copied from class: Configuration
        The compareTo-method.
        Specified by:
        compareTo in interface java.lang.Comparable
        Overrides:
        compareTo in class Configuration
        Parameters:
        a_other - the other object to compare
        Returns:
        -1, 0, 1
      • isMaxNodeWarningPrinted

        public boolean isMaxNodeWarningPrinted()
        Returns:
        see ProgramChromosome.growOrFull(...) and GPGenotype.evolve()
        Since:
        3.2
      • flagMaxNodeWarningPrinted

        public void flagMaxNodeWarningPrinted()
        See ProgramChromosome.growOrFull(...) and GPGenotype.evolve().
        Since:
        3.2
      • setPrototypeProgram

        public void setPrototypeProgram(IGPProgram a_program)
        Parameters:
        a_program - IGPProgram
        Since:
        3.2
      • getPrototypeProgram

        public IGPProgram getPrototypeProgram()
        Returns:
        prototype program set (maybe null if not setted previously)
        Since:
        3.2
      • getMemorySize

        public int getMemorySize()
        Returns:
        capacity of the memory in cells
        Since:
        3.2
      • isUseProgramCache

        public boolean isUseProgramCache()
      • setUseProgramCache

        public void setUseProgramCache(boolean a_useCache)
      • putVariable

        public void putVariable(Variable a_var)
        Stores a Variable.
        Parameters:
        a_var - the Variable to store
        Since:
        3.2
      • getVariable

        public Variable getVariable(java.lang.String a_varName)
        Parameters:
        a_varName - name of variable to retriebe
        Returns:
        Variable instance or null, if not found
        Since:
        3.2
      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface ICloneable
        Overrides:
        clone in class Configuration
        Returns:
        deep clone of this instance
        Since:
        3.2
      • newInstanceGP

        public GPConfiguration newInstanceGP(java.lang.String a_id,
                                             java.lang.String a_name)
        Creates a new GPConfiguration instance by cloning. Allows to preset the ID and the name.
        Parameters:
        a_id - new ID for clone
        a_name - new name for clone
        Returns:
        deep clone of this instance
        Since:
        3.2
      • setInitStrategy

        public void setInitStrategy(IGPInitStrategy a_strategy)
        Parameters:
        a_strategy - IGPInitStrategy
        Since:
        3.2.2
      • getInitStrategy

        public IGPInitStrategy getInitStrategy()
        Returns:
        IGPInitStrategy
        Since:
        3.2.2
      • setVerifyPrograms

        public void setVerifyPrograms(boolean a_verify)
        Parameters:
        a_verify - true: verify GP programs for correctness (i.e. is fitness computation possible without exception?)
        Since:
        3.3.4
      • isVerifyPrograms

        public boolean isVerifyPrograms()
        Returns:
        true: verify GP programs for correctness (i.e. is fitness computation possible without exception?)
        Since:
        3.3.4
      • setNoCommandGeneCloning

        public void setNoCommandGeneCloning(boolean a_noCommandGeneCloning)
        Decide whether to clone command genes when creating a new GP program in ProgramChromosome.
        Parameters:
        a_noCommandGeneCloning - boolean
        Since:
        3.4.3
      • isNoCommandGeneCloning

        public boolean isNoCommandGeneCloning()
        Returns:
        true: do not clone command genes when creating a new GP program in ProgramChromosome
        Since:
        3.4.3

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.