public static < G extends Gene < ? , G > , C extends Comparable < ? super C > > UnaryOperator < EvolutionResult < G , C > > toUniquePopulation ( final int maxRetries ) { return result -> { final Factory < Genotype < G > > factory = result . getPopulation ( ) . get ( 0 ) . getGenotype ( ) ; final UnaryOperator < EvolutionResult < G , C > > unifier = toUniquePopulation ( factory , maxRetries ) ; return unifier . apply ( result ) ; } ; }
Return a mapping function which removes duplicate individuals from the population and replaces it with newly created one by the existing genotype factory .