protected void checkNumberOfParents ( List < S > population , int numberOfParentsForCrossover ) { if ( ( population . size ( ) % numberOfParentsForCrossover ) != 0 ) { throw new JMetalException ( "Wrong number of parents: the remainder if the " + "population size (" + population . size ( ) + ") is not divisible by " + numberOfParentsForCrossover ) ; } }
A crossover operator is applied to a number of parents and it assumed that the population contains a valid number of solutions . This method checks that .