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; }
private void SetBestSequence() { BestSequence = CurrentPopulation .OrderBy(e => e.Cost) .First(); }