question: public Individual < A > geneticAlgorithm ( Collection < Individual < A > > initPopulation , FitnessFunction < A > fitnessFn , GoalTest goalTest , long maxTimeMilliseconds ) { Individual < A > bestIndividual = null ; List < Individual < A > > population = new ArrayList < Individual < A > > ( initPopulation ) ; validatePopulation ( population ) ; updateMetrics ( population , 0 , 0L ) ; long startTime = System . currentTimeMillis ( ) ; int itCount = 0 ; do { population = nextGeneration ( population , fitnessFn ) ; bestIndividual = retrieveBestIndividual ( population , fitnessFn ) ; updateMetrics ( population , ++ itCount , System . currentTimeMillis ( ) - startTime ) ; if ( maxTimeMilliseconds > 0L && ( System . currentTimeMillis ( ) - startTime ) > maxTimeMilliseconds ) break ; if ( CancelableThread . currIsCanceled ( ) ) break ; } while ( ! goalTest . isGoalState ( bestIndividual ) ) ; notifyProgressTracers ( itCount , population ) ; return bestIndividual ; }
target:  Template method controlling search. It returns the best individual in the specified population, according to the specified FITNESS-FN and goal test.