Documentation of 'org.jgap.gp.BaseGPChromosome' Java class
BaseGPChromosome
org.jgap.gp

Class BaseGPChromosome

  • All Implemented Interfaces:
    java.io.Serializable, IGPChromosome
    Direct Known Subclasses:
    ProgramChromosome


    public abstract class BaseGPChromosome
    extends java.lang.Object
    implements IGPChromosome
    Abstract base class for all implementations of IGPChromosome.
    Since:
    3.01
    See Also:
    Serialized Form
    • Method Detail

      • getIndividual

        public IGPProgram getIndividual()
        Specified by:
        getIndividual in interface IGPChromosome
        Returns:
        the individual containing this chromosome
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • setIndividual

        public void setIndividual(IGPProgram a_ind)
        Sets the individual the chromosome belongs to.
        Specified by:
        setIndividual in interface IGPChromosome
        Parameters:
        a_ind - the individual containing this chromosome
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • getTerminal

        public int getTerminal(int a_index)
        Gets the i'th terminal in this chromosome. The nodes are counted in a depth-first manner, with node zero being the first terminal in this chromosome.
        Specified by:
        getTerminal in interface IGPChromosome
        Parameters:
        a_index - the i'th terminal to get
        Returns:
        the terminal
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • getFunction

        public int getFunction(int a_index)
        Gets the a_index'th function in this chromosome. The nodes are counted in a depth-first manner, with node zero being the first function in this chromosome.
        Specified by:
        getFunction in interface IGPChromosome
        Parameters:
        a_index - the a_index'th function to get
        Returns:
        the function
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • getTerminal

        public int getTerminal(int a_index,
                               java.lang.Class a_type,
                               int a_subType)
        Gets the a_index'th terminal of the given type in this chromosome. The nodes are counted in a depth-first manner, with node zero being the first terminal of the given type in this chromosome.
        Specified by:
        getTerminal in interface IGPChromosome
        Parameters:
        a_index - the a_index'th terminal to get
        a_type - the type of terminal to get
        a_subType - the subtype to consider
        Returns:
        the index of the terminal found, or -1 if no appropriate terminal was found
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • getFunction

        public int getFunction(int a_index,
                               java.lang.Class a_type,
                               int a_subType)
        Gets the i'th function of the given return type in this chromosome. The nodes are counted in a depth-first manner, with node zero being the first function of the given type in this chromosome.
        Specified by:
        getFunction in interface IGPChromosome
        Parameters:
        a_index - the i'th function to get
        a_type - the type of function to get
        a_subType - the subtype to consider
        Returns:
        the index of the function found, or -1 if no appropriate function was found
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • numTerminals

        public int numTerminals()
        Specified by:
        numTerminals in interface IGPChromosome
        Returns:
        the number of terminals in this chromosome
        Since:
        3.0
      • numFunctions

        public int numFunctions()
        Specified by:
        numFunctions in interface IGPChromosome
        Returns:
        the number of functions in this chromosome
        Since:
        3.0
      • numTerminals

        public int numTerminals(java.lang.Class a_type,
                                int a_subType)
        Counts the number of terminals of the given type in this chromosome.
        Specified by:
        numTerminals in interface IGPChromosome
        Parameters:
        a_type - the type of terminal to count
        a_subType - the subtype to consider
        Returns:
        the number of terminals in this chromosome
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • numFunctions

        public int numFunctions(java.lang.Class a_type,
                                int a_subType)
        Counts the number of functions of the given type in this chromosome.
        Specified by:
        numFunctions in interface IGPChromosome
        Parameters:
        a_type - the type of function to count
        a_subType - the subtype to consider
        Returns:
        the number of functions in this chromosome.
        Since:
        3.01 (since 3.0 in ProgramChromosome)
      • getNode

        public CommandGene getNode(int a_index)
        Gets the a_index'th node in this chromosome. The nodes are counted in a depth-first manner, with node zero being the root of this chromosome.
        Specified by:
        getNode in interface IGPChromosome
        Parameters:
        a_index - the node number to get
        Returns:
        the node
        Since:
        3.01
      • getCommandOfClass

        public int getCommandOfClass(int a_n,
                                     java.lang.Class a_class)
        Helper: Find GP command with given class and return index of it.
        Parameters:
        a_n - return the n'th found command (starting at zero)
        a_class - the class to find a command for
        Returns:
        index of first found matching GP command, or -1 if none found
        Since:
        3.01
      • getAssignableFromClass

        public int getAssignableFromClass(int a_n,
                                          java.lang.Class a_class)
        Helper: Find GP command being assignable from given class.
        Parameters:
        a_n - return the n'th found command (starting at zero)
        a_class - the class to find a command for
        Returns:
        index of first found matching GP command, or -1 if none found
        Since:
        3.3
      • getVariableWithReturnType

        public int getVariableWithReturnType(int a_n,
                                             java.lang.Class a_returnType)
        Helper: Find GP Variable with given return type and return index of it.
        Parameters:
        a_n - return the n'th found command (starting at zero)
        a_returnType - the return type to find a Variable for
        Returns:
        index of first found matching GP command, or -1 if none found
        Since:
        3.01 (since 3.0 in ProgramChromosome)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.