Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public Osobnik znajdzNajlepszego(Graf graf){
  2.         int index = 0;
  3.         while (index == 0) index = SII.randInt(rozmiar-1);
  4.         List<Osobnik> temp = new ArrayList<Osobnik>();
  5.         for (int i = 0; i<15; i++){
  6.             temp.add(this.getOsobnicy().get(SII.randInt(rozmiar-1)));
  7.         }
  8.        Osobnik najlepszy = temp.get(0);
  9.         for (int i = 1; i<15; i++){
  10.             if (graf.funkcjaOceny(najlepszy) > graf.funkcjaOceny(temp.get(i))) najlepszy = temp.get(i);
  11.         }
  12.         return najlepszy;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement