src/GenFx.Components/Metrics/BestMinimumFitness.cs
/// <summary>
/// Calculates to determine the lowest <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>Smallest value of <see cref="GeneticEntity.ScaledFitnessValue"/> found.</returns>
/// <exception cref="ArgumentNullException"><paramref name="population"/> is null.</exception>
Calculates to determine the lowest
found for a  during the entire run of the genetic algorithm.
Calculates to determine the lowest 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.bestMinValues.TryGetValue(population.Index, out double? bestMin))
            {
                bestMin = null;
                this.bestMinValues.Add(population.Index, bestMin);
            }
            MinimumFitness minFitness = this.Algorithm!.Metrics.OfType<MinimumFitness>().First();
            double populationMin = (double)minFitness.GetResults(population.Index).Last().ResultValue;
            if (!bestMin.HasValue || bestMin > populationMin)
            {
                bestMin = populationMin;
                this.bestMinValues[population.Index] = bestMin;
            }
            return bestMin.Value;
        }
public override object GetResultValue ( Population population ) { if ( population == null ) { throw new ArgumentNullException ( nameof ( population ) ) ; } this . AssertIsInitialized ( ) ; if ( ! this . bestMinValues . TryGetValue ( population . Index , out double ? bestMin ) ) { bestMin = null ; this . bestMinValues . Add ( population . Index , bestMin ) ; } MinimumFitness minFitness = this . Algorithm ! . Metrics . OfType < MinimumFitness > ( ) . First ( ) ; double populationMin = ( double ) minFitness . GetResults ( population . Index ) . Last ( ) . ResultValue ; if ( ! bestMin . HasValue || bestMin > populationMin ) { bestMin = populationMin ; this . bestMinValues [ population . Index ] = bestMin ; } return bestMin . Value ; }
Calculates to determine the lowest
found for a  during the entire run of the genetic algorithm.
Calculates to determine the lowest found for a during the entire run of the genetic algorithm .
Smallest value of  found.
Smallest value of found .
None
population
Population
from which to derive the metric.
from which to derive the metric .