code: def main(seed=None):
      random.seed(seed)
  
      # Initialize statistics object
      stats = tools.Statistics(lambda ind: ind.fitness.values)
      stats.register("avg", numpy.mean, axis=0)
      stats.register("std", numpy.std, axis=0)
      stats.register("min", numpy.min, axis=0)
      stats.register("max", numpy.max, axis=0)
  
      logbook = tools.Logbook()
      logbook.header = "gen", "evals", "std", "min", "avg", "max"
  
      pop = toolbox.population(n=MU)
  
      # Evaluate the individuals with an invalid fitness
      invalid_ind = [ind for ind in pop if not ind.fitness.valid]
      fitnesses = toolbox.map(toolbox.evaluate, invalid_ind)
      for ind, fit in zip(invalid_ind, fitnesses):
          ind.fitness.values = fit
  
      # Compile statistics about the population
      record = stats.compile(pop)
      logbook.record(gen=0, evals=len(invalid_ind), **record)
      print(logbook.stream)
  
      # Begin the generational process
      for gen in range(1, NGEN):
          offspring = algorithms.varAnd(pop, toolbox, CXPB, MUTPB)
  
          # Evaluate the individuals with an invalid fitness
          invalid_ind = [
              ind for ind in offspring if not ind.fitness.valid
          ]
          fitnesses = toolbox.map(toolbox.evaluate, invalid_ind)
          for ind, fit in zip(invalid_ind, fitnesses):
              ind.fitness.values = fit
  
          # Select the next generation population from parents and offspring
          pop = toolbox.select(pop + offspring, MU)
  
          # Compile statistics about the new population
          record = stats.compile(pop)
          logbook.record(gen=gen, evals=len(invalid_ind), **record)
          print(logbook.stream)
  
      return pop, logbook
  
file_path: deap/examples/ga/nsga3.py
imports: from math import factorial
  import random
  import matplotlib.pyplot
  import numpy
  import pymop.factory
  from deap import algorithms
  from deap import base
  from deap.benchmarks.tools import igd
  from deap import creator
  from deap import tools
label_desc: Use image node_id 2 for calling a global function with example usage: main(seed) and returns: pop,  logbook