|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectec.cgp.Evaluator
public class Evaluator
Interprets the program encoded by an individual's genome, and evaluates the results of the program with the given inputs.
| Field Summary | |
|---|---|
(package private) static boolean |
DEBUG
|
(package private) static int |
evals
counter to track number of node evaluations performed. |
static java.util.List<java.util.Map<java.lang.Integer,java.lang.String>> |
expressionMap
maps String representations of node sub-expressions to their node numbers. |
static Functions |
functions
functions are loaded during setup. |
static java.util.List<java.util.Map<java.lang.Integer,java.lang.Object>> |
nodeMap
maps node evaluations to their node numbers. |
| Constructor Summary | |
|---|---|
Evaluator()
|
|
| Method Summary | |
|---|---|
static void |
add(boolean expression,
java.lang.StringBuffer sb,
java.lang.String msg)
Appends the given string to the given expression. |
static void |
debug(java.lang.String msg)
|
private static java.lang.Object |
evalNode(int threadNum,
boolean expression,
java.lang.Object[] inputs,
java.lang.StringBuffer expr,
java.lang.Object genome,
int nodeNum,
VectorSpeciesCGP s)
Computes the result of evaluating the given node. |
static java.lang.Object[] |
evaluate(ec.EvolutionState state,
int threadNum,
java.lang.Object[] inputs,
VectorIndividualCGP ind)
Evaluate the genome against the given inputs. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static boolean DEBUG
static int evals
public static java.util.List<java.util.Map<java.lang.Integer,java.lang.Object>> nodeMap
public static java.util.List<java.util.Map<java.lang.Integer,java.lang.String>> expressionMap
public static Functions functions
| Constructor Detail |
|---|
public Evaluator()
| Method Detail |
|---|
public static java.lang.Object[] evaluate(ec.EvolutionState state,
int threadNum,
java.lang.Object[] inputs,
VectorIndividualCGP ind)
inputs - inputs used to evaluate genomeind - the current individual
private static java.lang.Object evalNode(int threadNum,
boolean expression,
java.lang.Object[] inputs,
java.lang.StringBuffer expr,
java.lang.Object genome,
int nodeNum,
VectorSpeciesCGP s)
threadNum - The current thread number.expression - If true, compute the string representation of the
sub-expression represented by this node.inputs - The input values for this evaluation.expr - Storage for the String-representation of the entire expression.genome - The current genome.nodeNum - The node number we are evaluating.s - The CGP species
public static void add(boolean expression,
java.lang.StringBuffer sb,
java.lang.String msg)
expression - If true, append; otherwise, ignore.sb - The target expression.msg - The snippet to append to the target.public static void debug(java.lang.String msg)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||