Exemplo n.º 1
0
        protected virtual void CalculateRemarkableValues()
        {
            // Because Genomes are sorted :
            //   First = worst
            //   Last = best

            WorstFitness = Math.Min(Genomes.First().Fitness, WorstFitness);
            TotalFitness = Genomes.Sum(g => g.Fitness);

            double bestGenomeFitness = Genomes.Last().Fitness;

            if (bestGenomeFitness > BestFitness)
            {
                BestFitnessGenome = Genomes.Last();
                BestFitness       = bestGenomeFitness;

                if (bestGenomeFitness > BestFitnessEver)
                {
                    BestFitnessGenomeEver = BestFitnessGenome;
                    BestFitnessEver       = bestGenomeFitness;
                }
            }
        }