Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Robot[] nejlepsiJedinecPopulace(Robot[] populace)
- {
- int pocet_nejlepsich = 3;
- Robot[] N_nejlepsich = new Robot[pocet_nejlepsich];
- Map<Double, Robot> map = new TreeMap<Double, Robot>();
- for(int i=0;i<populace.length;i++)
- {
- map.put(fitness(populace[i], 5), populace[i]);
- }
- short i = 0;
- short j = 0;
- for(Double key : map.keySet())
- {
- if(i >= 7) { N_nejlepsich[j] = map.get(key); j++;}
- i++;
- }
- return N_nejlepsich;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement