Ejemplo n.º 1
0
        /// <summary>
        /// Picks the given number of individuals with the best scores.
        /// </summary>
        /// <param name="WinnersCount"></param>
        /// <returns>List of genomes</returns>
        public IEnumerable <string> PickWinners(int WinnersCount)
        {
            var minScore = Individuals.Min(i => i.Score);

            return(Individuals.OrderByDescending(i =>
            {
                var randomNumber = _rng.NextDouble();
                return (1 + i.AverageScore - minScore) * randomNumber;
            }).Take(WinnersCount).Select(i => i.Genome));
        }