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)
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)
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)
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)