code: def main():
      random.seed(64)
  
      hosts = htoolbox.population(n=300)
      parasites = ptoolbox.population(n=300)
      hof = tools.HallOfFame(1)
  
      hstats = tools.Statistics(lambda ind: ind.fitness.values)
      hstats.register("avg", numpy.mean)
      hstats.register("std", numpy.std)
      hstats.register("min", numpy.min)
      hstats.register("max", numpy.max)
  
      logbook = tools.Logbook()
      logbook.header = "gen", "evals", "std", "min", "avg", "max"
  
      MAXGEN = 50
      H_CXPB, H_MUTPB = 0.5, 0.3
      P_CXPB, P_MUTPB = 0.5, 0.3
  
      fits = htoolbox.map(htoolbox.evaluate, hosts, parasites)
      for host, parasite, fit in zip(hosts, parasites, fits):
          host.fitness.values = parasite.fitness.values = fit
  
      hof.update(hosts)
      record = hstats.compile(hosts)
      logbook.record(gen=0, evals=len(hosts), **record)
      print(logbook.stream)
  
      for g in range(1, MAXGEN):
          hosts = htoolbox.select(hosts, len(hosts))
          parasites = ptoolbox.select(parasites, len(parasites))
  
          hosts = algorithms.varAnd(hosts, htoolbox, H_CXPB, H_MUTPB)
          parasites = algorithms.varAnd(
              parasites, ptoolbox, P_CXPB, P_MUTPB
          )
  
          fits = htoolbox.map(htoolbox.evaluate, hosts, parasites)
          for host, parasite, fit in zip(hosts, parasites, fits):
              host.fitness.values = parasite.fitness.values = fit
  
          hof.update(hosts)
          record = hstats.compile(hosts)
          logbook.record(gen=g, evals=len(hosts), **record)
          print(logbook.stream)
  
      best_network = sn.SortingNetwork(INPUTS, hof[0])
      print(best_network)
      print(best_network.draw())
      print("%i errors" % best_network.assess())
  
      return hosts, logbook, hof
  
file_path: deap/examples/coev/hillis.py
imports: import random
  import sys
  import numpy
  from deap import algorithms
  from deap import base
  from deap import creator
  from deap import tools
  import sortingnetwork
label_desc: Use image node_id 9 for calling a global function with example usage: main() and returns: hosts,  logbook,  hof