JGAP

examples.gp
Class FibonacciNodeValidator

java.lang.Object
  extended by examples.gp.FibonacciNodeValidator
All Implemented Interfaces:
java.io.Serializable, INodeValidator

public class FibonacciNodeValidator
extends java.lang.Object
implements INodeValidator

Validates evolved nodes for the Fibonacci problem. This is mainly to demonstrate how the node validator works.

Since:
3.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jgap.gp.INodeValidator
CVS_REVISION
 
Constructor Summary
FibonacciNodeValidator()
           
 
Method Summary
 boolean validate(ProgramChromosome a_chrom, CommandGene a_node, CommandGene a_rootNode, int a_tries, int a_num, int a_recurseLevel, java.lang.Class a_type, CommandGene[] a_functionSet, int a_depth, boolean a_grow, int a_childIndex, boolean a_fullProgram)
          Validates a_node in the context of a_chrom during evolution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FibonacciNodeValidator

public FibonacciNodeValidator()
Method Detail

validate

public boolean validate(ProgramChromosome a_chrom,
                        CommandGene a_node,
                        CommandGene a_rootNode,
                        int a_tries,
                        int a_num,
                        int a_recurseLevel,
                        java.lang.Class a_type,
                        CommandGene[] a_functionSet,
                        int a_depth,
                        boolean a_grow,
                        int a_childIndex,
                        boolean a_fullProgram)
Validates a_node in the context of a_chrom during evolution. Considers the recursion level (a_recursLevel), the type needed (a_type) for the node, the functions available (a_functionSet) and the depth of the whole chromosome needed (a_depth), and whether grow mode is used (a_grow is true) or not.

Specified by:
validate in interface INodeValidator
Parameters:
a_chrom - the chromosome that will contain the node, if valid (ignored in this implementation)
a_node - the node selected and to be validated
a_rootNode - the root node of a_node, may be null for top nodes
a_tries - number of times the validator has been called, useful for stopping by returning true if the number exceeds a limit
a_num - the chromosome's index in the individual of this chromosome
a_recurseLevel - level of recursion
a_type - the return type of the node needed
a_functionSet - the array of available functions (ignored in this implementation)
a_depth - the needed depth of the program chromosome
a_grow - true: use grow mode, false: use full mode (ignored in this implementation)
a_childIndex - index of the child in the parent node to which it belongs (-1 if node is root node)
a_fullProgram - true: whole program is available in a_chrom
Returns:
true: node is valid; false: node is invalid
Since:
3.0

JGAP