Genetic programming gene, which represents arithmetic functions, common mathematical functions and arguments.

Extended gene function may represent arithmetic functions (+, -, *, /), some common mathematical functions (sin, cos, ln, exp, sqrt) or an argument to functions. This class is used by Genetic Programming (or Gene Expression Programming) chromosomes to build arbitrary expressions with help of genetic operators.

Inheritance: IGPGene
示例#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 ...
            ExtendedGeneFunction clone = new ExtendedGeneFunction(variablesCount, false);

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

            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 ...
            var clone = new ExtendedGeneFunction(variablesCount, false)
            {
                // ... with the same type and value
                type           = type,
                val            = val,
                argumentsCount = argumentsCount
            };

            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 ...
            ExtendedGeneFunction clone = new ExtendedGeneFunction( variablesCount, false );
            // ... with the same type and value
            clone.type = type;
            clone.val  = val;
            clone.argumentsCount = argumentsCount;

            return clone;
        }