old_contents: import os
  import neat
  
  
  def eval_dummy_genome(genome, config):
      return 1.0
  
  
  def eval_dummy_genomes(genomes, config):
      for genome_id, genome in genomes:
          genome.fitness = eval_dummy_genome(genome, config)
  
  
  def test_serial():
      # Load configuration.
      local_dir = os.path.dirname(__file__)
      config_path = os.path.join(local_dir, 'test_configuration')
      config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction,
                           neat.DefaultSpeciesSet, neat.DefaultStagnation,
                           config_path)
  
      # Create the population, which is the top-level object for a NEAT run.
      p = neat.Population(config)
  
      # Add a stdout reporter to show progress in the terminal.
      p.add_reporter(neat.StdOutReporter(True))
      stats = neat.StatisticsReporter()
      p.add_reporter(stats)
  
      # Run for up to 300 generations.
      p.run(eval_dummy_genomes, 300)
  
      stats.save()
  
  
  def test_parallel():
      # Load configuration.
      local_dir = os.path.dirname(__file__)
      config_path = os.path.join(local_dir, 'test_configuration')
      config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction,
                           neat.DefaultSpeciesSet, neat.DefaultStagnation,
                           config_path)
  
      # Create the population, which is the top-level object for a NEAT run.
      p = neat.Population(config)
  
      # Add a stdout reporter to show progress in the terminal.
      p.add_reporter(neat.StdOutReporter(True))
      stats = neat.StatisticsReporter()
      p.add_reporter(stats)
  
      # Run for up to 300 generations.
      pe = neat.ParallelEvaluator(4, eval_dummy_genome)
      p.run(pe.evaluate, 300)
  
      stats.save()
  
  
  if __name__ == '__main__':
      test_serial()
      test_parallel()
new_contents: import os
  import neat
  
  
  def eval_dummy_genome(genome, config):
      return 1.0
  
  
  def eval_dummy_genomes(genomes, config):
      for genome_id, genome in genomes:
          genome.fitness = eval_dummy_genome(genome, config)
  
  
  def test_serial():
      # Load configuration.
      local_dir = os.path.dirname(__file__)
      config_path = os.path.join(local_dir, 'test_configuration')
      config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction,
                           neat.DefaultSpeciesSet, neat.DefaultStagnation,
                           config_path)
  
      # Create the population, which is the top-level object for a NEAT run.
      p = neat.Population(config)
  
      # Add a stdout reporter to show progress in the terminal.
      p.add_reporter(neat.StdOutReporter(True))
      stats = neat.StatisticsReporter()
      p.add_reporter(stats)
      p.add_reporter(neat.Checkpointer(1, 5))
  
      # Run for up to 300 generations.
      p.run(eval_dummy_genomes, 300)
  
      stats.save()
  
  
  def test_parallel():
      # Load configuration.
      local_dir = os.path.dirname(__file__)
      config_path = os.path.join(local_dir, 'test_configuration')
      config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction,
                           neat.DefaultSpeciesSet, neat.DefaultStagnation,
                           config_path)
  
      # Create the population, which is the top-level object for a NEAT run.
      p = neat.Population(config)
  
      # Add a stdout reporter to show progress in the terminal.
      p.add_reporter(neat.StdOutReporter(True))
      stats = neat.StatisticsReporter()
      p.add_reporter(stats)
  
      # Run for up to 300 generations.
      pe = neat.ParallelEvaluator(4, eval_dummy_genome)
      p.run(pe.evaluate, 300)
  
      stats.save()
  
  
  if __name__ == '__main__':
      test_serial()
      test_parallel()
subject: Use checkpointer in simple run test.