Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public static Robot[] nejlepsiJedinecPopulace(Robot[] populace)
  2. {
  3. int pocet_nejlepsich = 3;
  4. Robot[] N_nejlepsich = new Robot[pocet_nejlepsich];
  5. Map<Double, Robot> map = new TreeMap<Double, Robot>();
  6. for(int i=0;i<populace.length;i++)
  7. {
  8. map.put(fitness(populace[i], 5), populace[i]);
  9.  
  10. }
  11. short i = 0;
  12. short j = 0;
  13. for(Double key : map.keySet())
  14. {
  15. if(i >= 7) { N_nejlepsich[j] = map.get(key); j++;}
  16. i++;
  17. }
  18. return N_nejlepsich;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement