org.jgap.gp
Interface IGPChromosome
-
- All Superinterfaces:
- java.io.Serializable
- All Known Implementing Classes:
- BaseGPChromosome, ProgramChromosome
public interface IGPChromosome extends java.io.SerializableInterface for GP chromosomes. See ProgramChromosome for an implementation.- Since:
- 3.01
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringCVS_REVISIONString containing the CVS revision.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidcleanup()Clean up the chromosome.intgetChild(int a_index, int a_child)Gets the a_child'th child of the a_index'th node in this chromosome.intgetFunction(int a_index)Gets the a_index'th function in this chromosome.intgetFunction(int a_index, java.lang.Class a_type, int a_subType)Gets the i'th function of the given type in this chromosome.CommandGene[]getFunctions()CommandGene[]getFunctionSet()GPConfigurationgetGPConfiguration()IGPProgramgetIndividual()CommandGenegetNode(int a_index)Gets the a_index'th node in this chromosome.java.lang.StringgetPersistentRepresentation()intgetTerminal(int a_index)Gets the i'th terminal in this chromosome.intgetTerminal(int a_index, java.lang.Class a_type, int a_subType)Gets the a_index'th terminal of the given type in this chromosome.intnumFunctions()intnumFunctions(java.lang.Class a_type, int a_subType)Counts the number of functions of the given type in this chromosome.intnumTerminals()intnumTerminals(java.lang.Class a_type, int a_subType)Counts the number of terminals of the given type in this chromosome.voidredepth()Recalculate the depths of each node.voidsetIndividual(IGPProgram a_ind)Sets the individual the chromosome belongs to.java.lang.StringtoStringNorm(int a_startNode)Output program in "natural" notion (e.g.: "X + Y" for "X + Y")
-
-
-
Field Detail
-
CVS_REVISION
static final java.lang.String CVS_REVISION
String containing the CVS revision. Read out via reflection!- See Also:
- Constant Field Values
-
-
Method Detail
-
getIndividual
IGPProgram getIndividual()
- Returns:
- the individual containing this chromosome
- Since:
- 3.01
-
setIndividual
void setIndividual(IGPProgram a_ind)
Sets the individual the chromosome belongs to.- Parameters:
a_ind- the individual containing this chromosome- Since:
- 3.01
-
cleanup
void cleanup()
Clean up the chromosome.- Since:
- 3.01
-
toStringNorm
java.lang.String toStringNorm(int a_startNode)
Output program in "natural" notion (e.g.: "X + Y" for "X + Y")- Parameters:
a_startNode- the node to start with- Returns:
- output in normalized notion
- Since:
- 3.01
-
redepth
void redepth()
Recalculate the depths of each node.- Since:
- 3.01
-
numTerminals
int numTerminals()
- Returns:
- the number of terminals in this chromosome
- Since:
- 3.01
-
numFunctions
int numFunctions()
- Returns:
- the number of functions in this chromosome
- Since:
- 3.01
-
numTerminals
int numTerminals(java.lang.Class a_type, int a_subType)Counts the number of terminals of the given type in this chromosome.- Parameters:
a_type- the type of terminal to counta_subType- the subtype to consider- Returns:
- the number of terminals in this chromosome
- Since:
- 3.01
-
numFunctions
int numFunctions(java.lang.Class a_type, int a_subType)Counts the number of functions of the given type in this chromosome.- Parameters:
a_type- the type of function to counta_subType- the subtype to consider- Returns:
- the number of functions in this chromosome.
- Since:
- 3.01
-
getNode
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 0 being the root of this chromosome.- Parameters:
a_index- the node number to get- Returns:
- the node
- Since:
- 3.01
-
getChild
int getChild(int a_index, int a_child)Gets the a_child'th child of the a_index'th node in this chromosome. This is the same as the a_child'th node whose depth is one more than the depth of the a_index'th node.- Parameters:
a_index- the node number of the parenta_child- the child number (starting from 0) of the parent- Returns:
- the node number of the child, or -1 if not found
- Since:
- 3.01
-
getTerminal
int getTerminal(int a_index)
Gets the i'th terminal in this chromosome. The nodes are counted in a depth-first manner, with node 0 being the first terminal in this chromosome.- Parameters:
a_index- the i'th terminal to get- Returns:
- the terminal
- Since:
- 3.01
-
getFunction
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 0 being the first function in this chromosome.- Parameters:
a_index- the a_index'th function to get- Returns:
- the function
- Since:
- 3.01
-
getTerminal
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 0 being the first terminal of the given type in this chromosome.- Parameters:
a_index- the a_index'th terminal to geta_type- the type of terminal to geta_subType- the subtype to consider- Returns:
- the index of the terminal found, or -1 if no appropriate terminal was found
- Since:
- 3.01
-
getFunction
int getFunction(int a_index, java.lang.Class a_type, int a_subType)Gets the i'th function of the given type in this chromosome. The nodes are counted in a depth-first manner, with node 0 being the first function of the given type in this chromosome.- Parameters:
a_index- the i'th function to geta_type- the type of function to geta_subType- the subtype to consider- Returns:
- the index of the function found, or -1 if no appropriate function was found
- Since:
- 3.01
-
getFunctions
CommandGene[] getFunctions()
-
getFunctionSet
CommandGene[] getFunctionSet()
- Returns:
- set of CommandGene instances allowed
- Since:
- 3.2.1
-
getGPConfiguration
GPConfiguration getGPConfiguration()
-
getPersistentRepresentation
java.lang.String getPersistentRepresentation()
- Returns:
- the persistent representation of the population, including all GP programs
- Since:
- 3.3
-
-
DMelt 3.0 © DataMelt by jWork.ORG