コード例 #1
0
 private List <Chromosome> GetBestModelsInList(int numberOfBestChromosomes)
 {
     EvaluateModels();
     return(Chromosomes.OrderByDescending(chromosome => chromosome.Metrics.MicroAccuracy)
            .ThenByDescending(chromosome => chromosome.Metrics.MacroAccuracy)
            .Take(numberOfBestChromosomes).ToList());
 }
コード例 #2
0
        /// <summary>
        /// Ends the generation.
        /// </summary>
        /// <param name="chromosomesNumber">Chromosomes number to keep on generation.</param>
        public void End(int chromosomesNumber)
        {
            Chromosomes = Chromosomes.OrderByDescending(c => c.Fitness.Value).ToList();

            if (Chromosomes.Count > chromosomesNumber)
            {
                Chromosomes = Chromosomes.Take(chromosomesNumber).ToList();
            }

            ElectBestChromosome();
        }
コード例 #3
0
 // TODO -> This should not be like this
 public void SortByFitness()
 {
     Chromosomes = Chromosomes.OrderByDescending(c => c.Fitness).ToArray();
 }
コード例 #4
0
 private Chromosome GetBestModelInList()
 {
     EvaluateModels();
     return(Chromosomes.OrderByDescending(chromosome => chromosome.Metrics.MicroAccuracy).ThenByDescending(chromosome => chromosome.Metrics.MicroAccuracy).ToList().First());
 }