Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)