Package ec.gp
Class GPFunctionSet
java.lang.Object
ec.gp.GPFunctionSet
- All Implemented Interfaces:
Clique,Setup,Serializable
- Direct Known Subclasses:
PTCFunctionSet
GPFunctionSet is a Clique which represents a set of GPNode prototypes
forming a standard function set for forming certain trees in individuals.
GPFunctionSets instances have unique names with which they're referenced by
GPTreeConstraints objects indicating that they're used for certain trees.
GPFunctionSets store their GPNode Prototypes in three hashtables,
one for all nodes, one for nonterminals, and one for terminals. Each
hashed item is an array of GPNode objects,
hashed by the return type of the GPNodes in the array.
GPFunctionSets also contain prototypical GPNode nodes which they
clone to form their arrays.
Parameters
| base.name String |
(name of function set. Must be different from other function set instances) |
| base.size int >= 1 |
(number of functions in the function set) |
| base.func.n classname, inherits and != ec.gp.GPNode |
(class of function node n in the set) |
Parameter bases
| base.func.n | function node n |
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionName of the GPFunctionSetGPNode[][]The nodes that our GPTree can use: nodes[type][thenodes].The nodes that our GPTree can use: arrays of nodes hashed by type.GPNode[][][]Nodes == a given arity, that is: nodesByArity[type][arity][thenodes]The nodes that our GPTree can use, hashed by name().GPNode[][]The nonterminals our GPTree can use: nonterminals[type][thenodes].The nonterminals our GPTree can use: arrays of nonterminals hashed by type.GPNode[][][]Nonterminals >= a given arity, that is: nonterminalsOverArity[type][arity][thenodes] -- this will be O(n^2).GPNode[][][]Nonterminals invalid input: '<'= a given arity, that is: nonterminalsUnderArity[type][arity][thenodes] -- this will be O(n^2).static final Stringstatic final Stringstatic final StringGPNode[][]The terminals our GPTree can use: terminals[type][thenodes].The terminals our GPTree can use: arrays of terminals hashed by type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GPFunctionSetfunctionSetFor(String functionSetName, EvolutionState state) Returns the function set for a given name.voidSets up the arrays based on the hashtablesvoidsetup(EvolutionState state, Parameter base) Must be done after GPType and GPNodeConstraints have been set uptoString()Returns the name.
-
Field Details
-
P_NAME
- See Also:
-
P_FUNC
- See Also:
-
P_SIZE
- See Also:
-
name
Name of the GPFunctionSet -
nodes_h
The nodes that our GPTree can use: arrays of nodes hashed by type. -
nodes
The nodes that our GPTree can use: nodes[type][thenodes]. -
nonterminals_h
The nonterminals our GPTree can use: arrays of nonterminals hashed by type. -
nonterminals
The nonterminals our GPTree can use: nonterminals[type][thenodes]. -
terminals_h
The terminals our GPTree can use: arrays of terminals hashed by type. -
terminals
The terminals our GPTree can use: terminals[type][thenodes]. -
nodesByName
The nodes that our GPTree can use, hashed by name(). -
nodesByArity
Nodes == a given arity, that is: nodesByArity[type][arity][thenodes] -
nonterminalsUnderArity
Nonterminals invalid input: '<'= a given arity, that is: nonterminalsUnderArity[type][arity][thenodes] -- this will be O(n^2). Obviously, the number of nonterminals at arity slot 0 is 0. -
nonterminalsOverArity
Nonterminals >= a given arity, that is: nonterminalsOverArity[type][arity][thenodes] -- this will be O(n^2). Obviously, the number of nonterminals at arity slot 0 is all the nonterminals of that type.
-
-
Constructor Details
-
GPFunctionSet
public GPFunctionSet()
-
-
Method Details
-
toString
Returns the name. -
postProcessFunctionSet
public void postProcessFunctionSet()Sets up the arrays based on the hashtables -
setup
Must be done after GPType and GPNodeConstraints have been set up -
functionSetFor
Returns the function set for a given name. You must guarantee that after calling functionSetFor(...) one or several times, you call state.output.exitIfErrors() once.
-