Class BoolTree

java.lang.Object
  |
  +--BoolTree

public class BoolTree
extends java.lang.Object

BoolTree is an evolvable GP class for Boolean S-Expression Trees (AND, OR, NOT, terminals)

Since:
JDK1.2

Constructor Summary
BoolTree(int nterm, int size, java.util.Random rand)
          Creates a random BoolTree S-Expression.
 
Method Summary
static BoolTree[] cross(BoolTree t1, BoolTree t2)
          Performs crossover of two trees to produce two offspring.
 boolean eval(boolean[] pat)
          Evaluates S-expression on terminal pattern
 java.lang.String toString()
          Returns S-expression representation of this tree for output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoolTree

public BoolTree(int nterm,
                int size,
                java.util.Random rand)
Creates a random BoolTree S-Expression.

Parameters:
nterm - number of possible terminals
size - maximum number of non-terminal nodes
rand - random number generator
Method Detail

toString

public java.lang.String toString()
Returns S-expression representation of this tree for output. This routine is called when you call System.out.println() or a related output routine with the BoolTree as an argument.

Overrides:
toString in class java.lang.Object
Returns:
parenthesized string representation of S-Expression for tree

cross

public static BoolTree[] cross(BoolTree t1,
                               BoolTree t2)
Performs crossover of two trees to produce two offspring.

Parameters:
t1 - first tree
t2 - second tree
Returns:
length-two array of offspring

eval

public boolean eval(boolean[] pat)
Evaluates S-expression on terminal pattern

Parameters:
pat - pattern
Returns:
true or false