Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. for (int j = 0; j < 199; j++)
  2. {
  3. Path oldBest = population[j];
  4. Path newBest = offsprings[j];
  5.  
  6. if (oldBest.sumOfDistance < newBest.sumOfDistance)
  7. nextGen.Add(oldBest);
  8. else
  9. nextGen.Add(newBest);
  10.  
  11. /*
  12.  
  13.  
  14. Path oldBest = population[0];
  15. Path newBest = offsprings[0];
  16. for (int k = 1; k < population.Count; k++)
  17. {
  18. if (oldBest.sumOfDistance > population[k].sumOfDistance)
  19. oldBest = population[k];
  20. }
  21. for (int k = 1; k < offsprings.Count; k++)
  22. {
  23. if (newBest.sumOfDistance > offsprings[k].sumOfDistance)
  24. newBest = offsprings[k];
  25. }
  26. if (oldBest.sumOfDistance > newBest.sumOfDistance && !isDuplicated(nextGen, newBest))
  27. {
  28. nextGen.Add(newBest);
  29. offsprings.Remove(newBest);
  30. }
  31. else
  32. {
  33. nextGen.Add(oldBest);
  34. population.Remove(oldBest);
  35. } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement