code: def convergence(first_front, optimal_front):
      """Given a Pareto front `first_front` and the optimal Pareto front,
      this function returns a metric of convergence
      of the front as explained in the original NSGA-II article by K. Deb.
      The smaller the value is, the closer the front is to the optimal one.
      """
      distances = []
  
      for ind in first_front:
          distances.append(float("inf"))
          for opt_ind in optimal_front:
              dist = 0.0
              for i in range(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)
  
imports: from math import hypot, sqrt
  from functools import wraps
  from itertools import repeat
label_desc: Use image node_id 2 for calling a global function with example usage: convergence(first_front, optimal_front) and returns: unknown