public abstract class ERC extends GPNode
See the ec.app.regression.func.RegERC class for an example of a simple but "fuly-implemented" ERC. A slightly more complicated example can be found in ec.app.lawnmower.func.LawnERC.
argposition, children, CHILDREN_UNKNOWN, constraints, GPNODEPRINTTAB, MAXPRINTBYTES, NODESEARCH_ALL, NODESEARCH_CUSTOM, NODESEARCH_NONTERMINALS, NODESEARCH_TERMINALS, P_NODE, P_NODECONSTRAINTS, parent
Constructor and Description |
---|
ERC() |
Modifier and Type | Method and Description |
---|---|
boolean |
decode(DecodeReturn dret)
Decodes data into the ERC from dret.
|
abstract String |
encode()
Encodes data from the ERC, using ec.util.Code.
|
int |
expectedChildren()
Usually ERCs don't have children, and this default implementation makes certain of it.
|
void |
mutateERC(EvolutionState state,
int thread)
Mutates the node's "value".
|
String |
name()
Returns the lowercase "name" of this ERC function class, some
simple, short name which distinguishes this class from other ERC
function classes you're using.
|
abstract boolean |
nodeEquals(GPNode node)
Implement this to do ERC-to-ERC comparisons.
|
int |
nodeHashCode()
Implement this to hash ERCs, along with other nodes, in such a way that two
"equal" ERCs will usually hash to the same value.
|
GPNode |
readNode(DecodeReturn dret)
Reads the node symbol,
advancing the DecodeReturn to the first character in the string
beyond the node symbol, and returns a new, empty GPNode of the
appropriate class representing that symbol, else null if the
node symbol is not of the correct type for your GPNode class.
|
void |
readNode(EvolutionState state,
DataInput dataInput)
To successfully read from a DataOutput, you must override this to read your specific ERC data in.
|
abstract void |
resetNode(EvolutionState state,
int thread)
Remember to override this to randomize your ERC after it has been cloned.
|
String |
toString()
This defaults to simply name() + "[" + encode() + "]".
|
String |
toStringForHumans()
You might want to override this to return a special human-readable version of the erc value; otherwise this defaults to toString(); This should be something that resembles a LISP atom.
|
void |
writeNode(EvolutionState state,
DataOutput dataOutput)
To successfully write to a DataOutput, you must override this to write your specific ERC data out.
|
atDepth, checkConstraints, clone, cloneReplacing, cloneReplacing, cloneReplacing, cloneReplacingAtomic, cloneReplacingAtomic, cloneReplacingNoSubclone, constraints, contains, defaultBase, depth, errorInfo, eval, iterator, iterator, iterator, lightClone, makeCTree, makeGraphvizSubtree, makeGraphvizTree, makeLatexTree, makeLispTree, makeLispTree, meanDepth, nodeEquivalentTo, nodeInPosition, nodeInPosition, nodeInPosition, numNodes, numNodes, parentType, pathLength, pathLength, printNode, printNode, printNode, printNodeForHumans, printNodeForHumans, printRootedTree, printRootedTree, printRootedTree, printRootedTreeForHumans, printRootedTreeForHumans, readRootedTree, readRootedTree, replaceWith, rootedTreeEquals, rootedTreeHashCode, rootParent, setup, swapCompatibleWith, toStringForError, verify, writeRootedTree
public String name()
public int expectedChildren()
expectedChildren
in class GPNode
public abstract void resetNode(EvolutionState state, int thread)
public abstract boolean nodeEquals(GPNode node)
nodeEquals
in class GPNode
public int nodeHashCode()
nodeHashCode
in class GPNode
public String toStringForHumans()
toStringForHumans
in class GPNode
public String toString()
public abstract String encode()
public boolean decode(DecodeReturn dret)
public void mutateERC(EvolutionState state, int thread)
public void writeNode(EvolutionState state, DataOutput dataOutput) throws IOException
writeNode
in class GPNode
IOException
public void readNode(EvolutionState state, DataInput dataInput) throws IOException
readNode
in class GPNode
IOException
public GPNode readNode(DecodeReturn dret)
GPNode
Copyright © 2019. All rights reserved.