code: def main():
      # The cma module uses the numpy random number generator
      numpy.random.seed(128)
  
      # The CMA-ES algorithm takes a population of one individual as argument
      # The centroid is set to a vector of 5.0 see http://www.lri.fr/~hansen/cmaes_inmatlab.html
      # for more details about the rastrigin and other tests for CMA-ES
      strategy = cma.Strategy(
          centroid=[5.0] * N, sigma=5.0, lambda_=20 * N
      )
      toolbox.register(
          "generate", strategy.generate, creator.Individual
      )
      toolbox.register("update", strategy.update)
  
      hof = tools.HallOfFame(1)
      stats = tools.Statistics(lambda ind: ind.fitness.values)
      stats.register("avg", numpy.mean)
      stats.register("std", numpy.std)
      stats.register("min", numpy.min)
      stats.register("max", numpy.max)
  
      # The CMA-ES algorithm converge with good probability with those settings
      algorithms.eaGenerateUpdate(
          toolbox, ngen=250, stats=stats, halloffame=hof
      )
  
      # print "Best individual is %s, %s" % (hof[0], hof[0].fitness.values)
      return hof[0].fitness.values[0]
  
file_path: deap/examples/es/cma_minfct.py
imports: import numpy
  from deap import algorithms
  from deap import base
  from deap import benchmarks
  from deap import cma
  from deap import creator
  from deap import tools
label_desc: Use image node_id 1 for calling a global function with example usage: main() and returns: hof