ec.gp
Class GPNodeConstraints

java.lang.Object
  |
  +--ec.gp.GPNodeConstraints

public class GPNodeConstraints
extends java.lang.Object
implements Clique

A GPNodeConstraints is a Clique which defines constraint information common to many different GPNode functions, namely return types, child types, and number of children. GPNodeConstraints have unique names by which they are identified.

In adding new things to GPNodeConstraints, you should ask yourself the following questions: first, is this something that takes up too much memory to store in GPNodes themselves? second, is this something that needs to be accessed very rapidly, so cannot be implemented as a method call in a GPNode? third, can this be shared among different GPNodes, even ones representing different functions?

Parameters
base.size
int >= 1
(number of node constraints)
base.n.name
String
(name of node constraint n)
base.n.returns
String
(return type for node constraint n)
base.n.size
int >= 1
(number of child arguments for node constraint n)
base.n.child.m
String
(name of type for child argument m of node constraint n)
base.prob
float >= 0.0
(auxillary probability of selection -- used by ec.gp.build.PTC1 and ec.gp.build.PTC2)

See Also:
Serialized Form

Field Summary
static java.util.Hashtable all
          A repository of all the GPNodeConstraints in the system.
 GPType[] childtypes
          The children types for a GPNode
 byte constraintNumber
          The byte value of the constraints -- we can only have 256 of them
static GPNodeConstraints[] constraints
           
static float DEFAULT_PROBABILITY
           
 java.lang.String name
          The name of the GPNodeConstraints object -- this is NOT the name of the GPNode
static byte numConstraints
           
static java.lang.String P_CHILD
           
static java.lang.String P_NAME
           
static java.lang.String P_PROBABILITY
           
static java.lang.String P_RETURNS
           
static java.lang.String P_SIZE
           
 float probabilityOfSelection
          Probability of selection -- an auxillary measure mostly used by PTC1/PTC2 right now
 GPType returntype
          The return type for a GPNode
static int SIZE_OF_BYTE
           
 
Constructor Summary
GPNodeConstraints()
           
 
Method Summary
static GPNodeConstraints constraintsFor(java.lang.String name, EvolutionState state)
          You must guarantee that after calling constraintsFor(...) one or several times, you call state.output.exitIfErrors() once.
 void readObject(java.io.ObjectInputStream in)
           
 void setup(EvolutionState state, Parameter base)
          This must be called after the GPTypes have been set up.
static void setupConstraints(EvolutionState state, Parameter base)
          Sets up all the GPNodeConstraints, loading them from the parameter file.
 java.lang.String toString()
           
 void writeObject(java.io.ObjectOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE_OF_BYTE

public static final int SIZE_OF_BYTE

P_NAME

public static final java.lang.String P_NAME

P_RETURNS

public static final java.lang.String P_RETURNS

P_CHILD

public static final java.lang.String P_CHILD

P_SIZE

public static final java.lang.String P_SIZE

P_PROBABILITY

public static final java.lang.String P_PROBABILITY

DEFAULT_PROBABILITY

public static final float DEFAULT_PROBABILITY

probabilityOfSelection

public float probabilityOfSelection
Probability of selection -- an auxillary measure mostly used by PTC1/PTC2 right now

constraintNumber

public byte constraintNumber
The byte value of the constraints -- we can only have 256 of them

returntype

public GPType returntype
The return type for a GPNode

childtypes

public GPType[] childtypes
The children types for a GPNode

name

public java.lang.String name
The name of the GPNodeConstraints object -- this is NOT the name of the GPNode

all

public static java.util.Hashtable all
A repository of all the GPNodeConstraints in the system.

constraints

public static GPNodeConstraints[] constraints

numConstraints

public static byte numConstraints
Constructor Detail

GPNodeConstraints

public GPNodeConstraints()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setupConstraints

public static void setupConstraints(EvolutionState state,
                                    Parameter base)
Sets up all the GPNodeConstraints, loading them from the parameter file. This must be called before anything is called which refers to a type by name.

setup

public final void setup(EvolutionState state,
                        Parameter base)
This must be called after the GPTypes have been set up.

constraintsFor

public static GPNodeConstraints constraintsFor(java.lang.String name,
                                               EvolutionState state)
You must guarantee that after calling constraintsFor(...) one or several times, you call state.output.exitIfErrors() once.

writeObject

public final void writeObject(java.io.ObjectOutputStream out)
                       throws java.io.IOException

readObject

public final void readObject(java.io.ObjectInputStream in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException