Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int j = 0; j < 199; j++)
- {
- Path oldBest = population[j];
- Path newBest = offsprings[j];
- if (oldBest.sumOfDistance < newBest.sumOfDistance)
- nextGen.Add(oldBest);
- else
- nextGen.Add(newBest);
- /*
- Path oldBest = population[0];
- Path newBest = offsprings[0];
- for (int k = 1; k < population.Count; k++)
- {
- if (oldBest.sumOfDistance > population[k].sumOfDistance)
- oldBest = population[k];
- }
- for (int k = 1; k < offsprings.Count; k++)
- {
- if (newBest.sumOfDistance > offsprings[k].sumOfDistance)
- newBest = offsprings[k];
- }
- if (oldBest.sumOfDistance > newBest.sumOfDistance && !isDuplicated(nextGen, newBest))
- {
- nextGen.Add(newBest);
- offsprings.Remove(newBest);
- }
- else
- {
- nextGen.Add(oldBest);
- population.Remove(oldBest);
- } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement