Exemple #1
0
        public void UpdatePopulation()
        {
            var min = CurrentPopulation.First(y => CalculateCF(y) == CurrentPopulation.Min(x => CalculateCF(x)));

            if (CalculateCF(CurrentBlueChild) > CalculateCF(min))
            {
                CurrentPopulation[CurrentPopulation.IndexOf(min)] = CurrentBlueChild;
                min = CurrentPopulation.First(y => CalculateCF(y) == CurrentPopulation.Min(x => CalculateCF(x)));
            }

            if (CalculateCF(CurrentYellowChild) > CalculateCF(min))
            {
                CurrentPopulation[CurrentPopulation.IndexOf(min)] = CurrentYellowChild;
            }
        }