コード例 #1
0
ファイル: GeneticAlgorithm.cs プロジェクト: Maksym7355608/DO
        public (List <int>, float) GetTheBestChromosome()
        {
            var        best     = CurrentPopulation.First(y => CalculateCF(y) == CurrentPopulation.Max(x => CalculateCF(x)));
            List <int> cf_names = new List <int>();

            for (int i = 0; i < best.Count; i++)
            {
                if (best[i] == 1)
                {
                    cf_names.Add(i);
                }
            }

            var cf = CalculateCF(best);

            return(cf_names, cf);
        }