예제 #1
0
        public void CreateNewPopulation()
        {
            CurrentPopulation = Enumerable.Range(0, Algorithm.SeedingPopulationCount)
                                .Select(_ => GetRandomIndividual())
                                .ToList();

            ApplyBounds(CurrentPopulation);

            if (OptimizationTarget == OptimizationTarget.Minimum)
            {
                BestIndividual = CurrentPopulation.OrderBy(e => e.Cost).First();
            }
            else
            {
                BestIndividual = CurrentPopulation.OrderByDescending(e => e.Cost).First();
            }

            Generation = 0;
        }
예제 #2
0
파일: Population.cs 프로젝트: daywee/BIA
 private void SetBestSequence()
 {
     BestSequence = CurrentPopulation
                    .OrderBy(e => e.Cost)
                    .First();
 }