Пример #1
0
        private void InitializeRandom()
        {
            var rng = new Random();
            var randomIndicesList = Enumerable.Repeat(0, Size).Select(index => rng.Next(Individuals[0].Towns.Count))
                                    .ToList();

            Individuals = Individuals.AsParallel()
                          .Select((individual, i) => individual.MakeGreedy(individual.Towns[randomIndicesList[i]])).ToList();
        }
Пример #2
0
 private void InitializeBest()
 {
     Individuals = Individuals.AsParallel()
                   .Select((individual, i) => individual.MakeGreedy(individual.Towns[i])).ToList();
 }