Genetic programming gene, which represents simple arithmetic functions and arguments.

Simple gene function may represent an arithmetic function (+, -, *, /) or an argument to function. This class is used by Genetic Programming (or Gene Expression Programming) chromosomes to build arbitrary expressions with help of genetic operators.

Inheritance: IGPGene
Ejemplo n.º 1
0
        /// <summary>
        /// Clone the gene.
        /// </summary>
        ///
        /// <remarks><para>The method clones the chromosome returning the exact copy of it.</para></remarks>
        ///
        public IGPGene Clone( )
        {
            // create new gene ...
            SimpleGeneFunction clone = new SimpleGeneFunction(variablesCount, false);

            // ... with the same type and value
            clone.type = type;
            clone.val  = val;

            return(clone);
        }
        /// <summary>
        /// Clone the gene.
        /// </summary>
        /// 
        /// <remarks><para>The method clones the chromosome returning the exact copy of it.</para></remarks>
        /// 
        public IGPGene Clone( )
        {
            // create new gene ...
            SimpleGeneFunction clone = new SimpleGeneFunction( variablesCount, false );
            // ... with the same type and value
            clone.type = type;
            clone.val = val;

            return clone;
        }