def convergence(first_front, optimal_front):
 distances = []
 for ind in first_front:
  distances.append(float('inf'))
  for opt_ind in optimal_front:
   dist = 0.0
   for i in xrange(len(opt_ind)):
    dist += ((ind.fitness.values[i] - opt_ind[i]) ** 2)
   if (dist < distances[(-1)]):
    distances[(-1)] = dist
  distances[(-1)] = sqrt(distances[(-1)])
 return (sum(distances) / len(distances))

def convergence ( first_front , optimal_front ) : distances = [ ] for ind in first_front : distances . append ( float ( 'inf' ) ) for opt_ind in optimal_front : dist = 0.0 for i in xrange ( len ( opt_ind ) ) : dist += ( ( ind . fitness . values [ i ] - opt_ind [ i ] ) ** 2 ) if ( dist < distances [ ( - 1 ) ] ) : distances [ ( - 1 ) ] = dist distances [ ( - 1 ) ] = sqrt ( distances [ ( - 1 ) ] ) return ( sum ( distances ) / len ( distances ) )
given a pareto front first_front and the optimal pareto front .