Exemplo n.º 1
0
 def test_get_next_generation_max_mutation(self):
     environment = so.default_environment
     pop = main.create_initial_population()
     main.MUTATION_RATE = 1
     new_pop = main.get_next_generation(pop, environment)
     self.assertNotEqual(pop, new_pop)
     self.assertEqual(len(pop), len(new_pop))
Exemplo n.º 2
0
 def test_get_next_generation_no_mutation(self):
     environment = so.default_environment
     pop = main.create_initial_population()
     main.MUTATION_RATE = 0
     new_pop = main.get_next_generation(pop, environment)
     for org in new_pop:
         self.assertIn(org, pop)
     self.assertEqual(len(pop), len(new_pop))