KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > gp > INodeValidator


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap.gp;
11
12 import org.jgap.gp.impl.*;
13
14 /**
15  * A node validator checks whether a certain node is valid for a given
16  * evolution. See ProgramChromosome.growOrFullNode(..).<p>
17  * Purpose of this validator: If you have an idea of how the shape of your
18  * evolved program must look like regarding some spots (like the first node
19  * in the first chromosome to be evolved) then you can constrain your
20  * imaginations with this validator. But take care that constraining too much
21  * ( e.g., while not considering your available functions) may lead to an
22  * endless loop. The endless loop can be avoided by stopping after a number
23  * of tries (see method validate, parameter a_tries).
24  *
25  * @author Klaus Meffert
26  * @since 3.0
27  */

28 public interface INodeValidator {
29   /** String containing the CVS revision. Read out via reflection!*/
30   final static String JavaDoc CVS_REVISION = "$Revision: 1.3 $";
31
32   /**
33    * Validates a_node in the context of a_chrom. Considers the recursion level
34    * (a_recursLevel), the type needed (a_type) for the node, the functions
35    * available (a_functionSet) and the depth of the whole chromosome needed
36    * (a_depth), and whether grow mode is used (a_grow is true) or not.
37    *
38    * @param a_chrom the chromosome that will contain the node, if valid
39    * @param a_node the node selected and to be validated
40    * @param a_rootNode the root node of a_node, may be null for top nodes
41    * @param a_tries number of times the validator has been called, useful for
42    * stopping by returning true if the number exceeds a limit
43    * @param a_num the chromosome's index in the individual of this chromosome
44    * @param a_recursLevel level of recursion
45    * @param a_type the return type of the node needed
46    * @param a_functionSet the array of available functions
47    * @param a_depth the needed depth of the program chromosome
48    * @param a_grow true: use grow mode, false: use full mode
49    * @param a_childIndex index of the child in the parent node to which it
50    * belongs (-1 if node is root node)
51    * @return true: node is valid; false: node is invalid
52    *
53    * @author Klaus Meffert
54    * @since 3.0
55    */

56   boolean validate(ProgramChromosome a_chrom, CommandGene a_node,
57                    CommandGene a_rootNode, int a_tries,
58                    int a_num, int a_recursLevel, Class JavaDoc a_type,
59                    CommandGene[] a_functionSet, int a_depth,
60                    boolean a_grow, int a_childIndex);
61 }
62
Popular Tags