Ejemplo n.º 1
0
        /// <summary>
        /// Assign a fitness. If a fitness history buffer was created then the value will be
        /// enqueued in the buffer.
        /// </summary>
        public void SetFitness(double fitness)
        {
            if (fitness < 0.0)
            {
                throw new ArgumentOutOfRangeException("Negative fitness values are not valid.");
            }

            if (double.IsNaN(fitness))
            {
                throw new ArgumentOutOfRangeException("Negative fitness values are not valid. 00000");
            }

            if (double.IsInfinity(fitness))
            {
                throw new ArgumentOutOfRangeException("Negative fitness values are not valid. 11111");
            }

            _isEvaluated = true;
            _evaluationCount++;
            _fitness = fitness;

            if (null != _fitnessHistory)
            {
                _fitnessHistory.Enqueue(fitness);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Assign a fitness. If a fitness history buffer was created then the value will be
        ///     enqueued in the buffer.
        /// </summary>
        public void SetFitness(double fitness)
        {
            if (fitness < 0.0 || double.IsNaN(fitness) || double.IsInfinity(fitness))
            {
                throw new ArgumentOutOfRangeException("Negative fitness values are not valid.");
            }

            IsEvaluated = true;
            EvaluationCount++;
            MostRecentFitness = fitness;

            if (null != _fitnessHistory)
            {
                _fitnessHistory.Enqueue(fitness);
            }
        }