private boolean checkConvergence(Collection<Individuum> pop){
  if (pop.isEmpty()) {
    return true;
  }
  int[][] occur=new int[dim][phi + 1];
  for (  Individuum ind : pop) {
    short[] gene=ind.getGene();
    for (int d=0; d < dim; d++) {
      if (gene[d] == DONT_CARE) {
        occur[d][0]+=1;
        continue;
      }
      int val=gene[d] - GENE_OFFSET;
      if (val < 0 || val >= phi) {
        LOG.warning("Invalid gene value encountered: " + val + " in "+ ind.toString());
        continue;
      }
      occur[d][val + 1]+=1;
    }
  }
  int conv=(int)Math.floor(pop.size() * CONVERGENCE);
  if (LOG.isDebuggingFine()) {
    LOG.debugFine("Convergence at " + conv + " of "+ pop.size()+ " individuums.");
  }
  for (int d=0; d < dim; d++) {
    boolean converged=false;
    for (int val=0; val <= phi; val++) {
      if (occur[d][val] >= conv) {
        converged=true;
        break;
      }
    }
    if (!converged) {
      return false;
    }
  }
  return true;
}

private boolean checkConvergence ( Collection < Individuum > pop ) { if ( pop . isEmpty ( ) ) { return true ; } int [ ] [ ] occur = new int [ dim ] [ phi + 1 ] ; for ( Individuum ind : pop ) { short [ ] gene = ind . getGene ( ) ; for ( int d = 0 ; d < dim ; d ++ ) { if ( gene [ d ] == DONT_CARE ) { occur [ d ] [ 0 ] += 1 ; continue ; } int val = gene [ d ] - GENE_OFFSET ; if ( val < 0 || val >= phi ) { LOG . warning ( "Invalid gene value encountered: " + val + " in " + ind . toString ( ) ) ; continue ; } occur [ d ] [ val + 1 ] += 1 ; } } int conv = ( int ) Math . floor ( pop . size ( ) * CONVERGENCE ) ; if ( LOG . isDebuggingFine ( ) ) { LOG . debugFine ( "Convergence at " + conv + " of " + pop . size ( ) + " individuums." ) ; } for ( int d = 0 ; d < dim ; d ++ ) { boolean converged = false ; for ( int val = 0 ; val <= phi ; val ++ ) { if ( occur [ d ] [ val ] >= conv ) { converged = true ; break ; } } if ( ! converged ) { return false ; } } return true ; }
check the termination criterion .
