Beispiel #1
0
 def test_mutate(self):
     ea_template.initPopulation(ea_template.INITIAL_POPULATION)
     self.assertEqual(len(ea_template.population),
                      ea_template.INITIAL_POPULATION)
     ea_template.mutate(ea_template.DESIRED_CONFIDENCE)
     self.assertEqual(len(ea_template.population),
                      ea_template.INITIAL_POPULATION)
Beispiel #2
0
 def test_selection(self):
     ea_template.initPopulation(ea_template.INITIAL_POPULATION)
     self.assertEqual(len(ea_template.population),
                      ea_template.INITIAL_POPULATION)
     ea_template.selection(ea_template.SELECTED_COUNT)
     self.assertEqual(len(ea_template.population),
                      ea_template.SELECTED_COUNT)
Beispiel #3
0
 def test_crossover(self):
     ea_template.initPopulation(ea_template.INITIAL_POPULATION)
     self.assertEqual(len(ea_template.population),
                      ea_template.INITIAL_POPULATION)
     ea_template.crossover()
     self.assertEqual(len(ea_template.population),
                      ea_template.INITIAL_POPULATION * 2 - 1)
Beispiel #4
0
 def test_init_population(self):
     self.assertEqual(len(ea_template.population), 0)
     ea_template.initPopulation(ea_template.INITIAL_POPULATION)
     self.assertEqual(len(ea_template.population),
                      ea_template.INITIAL_POPULATION)