/// <summary>
 /// Genetic mutation for auxiliary argument data.
 /// </summary>
 public void MutateAuxArgs(double[] auxArgs, FastRandom rng, ZigguratGaussianSampler gaussianSampler, double connectionWeightRange)
 {
     throw new SharpNeatException("MutateAuxArgs() called on activation function that does not use auxiliary arguments.");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Genetic mutation for auxiliary argument data.
        /// </summary>
        public void MutateAuxArgs(double[] auxArgs, FastRandom rng, ZigguratGaussianSampler gaussianSampler, double connectionWeightRange)
        {
            // Mutate center.            
            // Add gaussian ditribution sample and clamp result to +-connectionWeightRange.
            double tmp = auxArgs[0] + gaussianSampler.NextSample(0, _auxArgsMutationSigmaCenter);
            if(tmp < -connectionWeightRange) {
                auxArgs[0] = -connectionWeightRange;
            }
            else if(tmp > connectionWeightRange) {
                auxArgs[0] = connectionWeightRange;
            } 
            else {
                auxArgs[0] = tmp;
            }

            // Mutate radius.
            // Add gaussian ditribution sample and clamp result to [0,1]
            tmp = auxArgs[1] + gaussianSampler.NextSample(0, _auxArgsMutationSigmaRadius);
            if(tmp < 0.0) {
                auxArgs[1] = 0.0;
            }
            else if(tmp > 1.0) {
                auxArgs[1] = 1.0;
            }
            else {
                auxArgs[1] = tmp;
            }
        }