src/GenFx.Components/Metrics/BestMaximumFitness.cs
/// <summary>
/// Calculates to determine the highest <see cref="GeneticEntity.ScaledFitnessValue"/> 
/// found for a <see cref="Population"/> during the entire run of the genetic algorithm.
/// </summary>
/// <param name="population"><see cref="Population"/> from which to derive the metric.</param>
/// <returns>Largest value of <see cref="GeneticEntity.ScaledFitnessValue"/> found.</returns>
/// <exception cref="ArgumentNullException"><paramref name="population"/> is null.</exception>
Calculates to determine the highest
found for a  during the entire run of the genetic algorithm.
Calculates to determine the highest found for a during the entire run of the genetic algorithm .
public override object GetResultValue(Population population)
        {
            if (population == null)
            {
                throw new ArgumentNullException(nameof(population));
            }
            this.AssertIsInitialized();
            if (!this.bestMaxValues.TryGetValue(population.Index, out double bestMax))
            {
                bestMax = Double.MinValue;
                this.bestMaxValues.Add(population.Index, bestMax);
            }
            MaximumFitness maxFitness = this.Algorithm!.Metrics.OfType<MaximumFitness>().First();
            double populationMax = (double)maxFitness.GetResults(population.Index).Last().ResultValue;
            if (bestMax < populationMax)
            {
                bestMax = populationMax;
                this.bestMaxValues[population.Index] = bestMax;
            }
            return bestMax;
        }
public override object GetResultValue ( Population population ) { if ( population == null ) { throw new ArgumentNullException ( nameof ( population ) ) ; } this . AssertIsInitialized ( ) ; if ( ! this . bestMaxValues . TryGetValue ( population . Index , out double bestMax ) ) { bestMax = Double . MinValue ; this . bestMaxValues . Add ( population . Index , bestMax ) ; } MaximumFitness maxFitness = this . Algorithm ! . Metrics . OfType < MaximumFitness > ( ) . First ( ) ; double populationMax = ( double ) maxFitness . GetResults ( population . Index ) . Last ( ) . ResultValue ; if ( bestMax < populationMax ) { bestMax = populationMax ; this . bestMaxValues [ population . Index ] = bestMax ; } return bestMax ; }
Calculates to determine the highest
found for a  during the entire run of the genetic algorithm.
Calculates to determine the highest found for a during the entire run of the genetic algorithm .
Largest value of  found.
Largest value of found .
None
population
Population
from which to derive the metric.
from which to derive the metric .