def test_Population_Constructor_Is_Valid(self):
     """
     Test the validity of the Population constructor
     """
     pops = p.Populations(self.__n_pop, self.__n_vars, self.__cost_func,
                          self.__domain_bounds)
     self.assertIsNotNone(pops, self.__test_msg)
Ejemplo n.º 2
0
 def __initialization(self):
     """
     Initialization of the ACO algorithm
     """
     pops = p.Populations(self.__n_pop, self.__n_vars, self.__cost_func, self.__domain_bounds)
     self.__pops_sorted = pops.ant_populations
     self.__final_best_solution = pops.best_population
     self.__w = self.__computePdf()
     self.__probs = self.__w/np.sum(self.__w)
     self.__means = np.zeros((self.__n_pop, self.__n_vars))
     self.__sigmas = np.zeros((self.__n_pop, self.__n_vars))
 def test_Population_Initialization_Is_valid(self):
     """
     Test the validity of the population initilaization
     """
     pops = p.Populations(self.__n_pop, self.__n_vars, self.__cost_func,
                          self.__domain_bounds)
     ant_populations = pops.ant_populations
     ant_populations_best = pops.best_population
     expected_n_pops = self.__n_pop
     actual_n_pops = len(ant_populations)
     self.assertIsNotNone(ant_populations, self.__test_msg)
     self.assertEqual(expected_n_pops, actual_n_pops, self.__test_msg)
     self.assertIsNotNone(ant_populations_best, self.__test_msg)