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(); }
private void InitializeBest() { Individuals = Individuals.AsParallel() .Select((individual, i) => individual.MakeGreedy(individual.Towns[i])).ToList(); }