예제 #1
0
    def test_hypervolume3D(self):
        """test the hypervolume in 3D"""
        population = []

        for i in range(10):
            population.append(self.rmnk3D.generate_random_solution())

        self.assertEqual(compute_hypervolume(population, [0, 0, 0]),
                         0.16108679722159508)  # test the hypervolume value
예제 #2
0
    def test_numerical_moead(self):
        """Test MOEA/D algorithm with ZDT1"""

        moead = Moead(problem=self.zdt1,
                      max_evaluation=self.number_of_evaluations,
                      number_of_objective=self.number_of_objective,
                      number_of_weight=self.number_of_weight,
                      number_of_weight_neighborhood=self.number_of_weight_neighborhood,
                      weight_file=self.weight_file,
                      aggregation_function=Tchebycheff
                      )

        non_dominated = moead.run()
        self.assertEqual(len(non_dominated), 6)  # test the number of non_dominated solutions
        self.assertEqual(compute_hypervolume(non_dominated, [11, 11]), 91.30063166767695)  # test the hypervolume value
예제 #3
0
    def test_moead(self):
        """Test MOEA/D algorithm"""

        moead = Moead(problem=self.rmnk,
                      max_evaluation=self.number_of_evaluations,
                      number_of_weight=self.number_of_weight,
                      aggregation_function=Tchebycheff,
                      number_of_weight_neighborhood=self.number_of_weight_neighborhood,
                      number_of_crossover_points=self.number_of_crossover_points,
                      weight_file=self.weight_file,
                      )

        non_dominated = moead.run()
        self.assertEqual(len(non_dominated), 8)  # test the number of non_dominated solutions
        self.assertEqual(compute_hypervolume(non_dominated, [0, 0]), 0.3079835420196539)  # test the hypervolume value
예제 #4
0
    def test_moead_sps_random(self):
        """Test MOEA/D algorithm with the random sps strategy"""
        number_of_subproblem = 2
        moead = MoeadSPSRandom(problem=self.rmnk,
                               max_evaluation=self.number_of_evaluations,
                               number_of_objective=self.number_of_objective,
                               aggregation_function=Tchebycheff,
                               number_of_weight_neighborhood=self.number_of_weight_neighborhood,
                               number_of_crossover_points=self.number_of_crossover_points,
                               number_of_subproblem_to_visit=number_of_subproblem,
                               weight_file=self.weight_file,
                               )

        non_dominated = moead.run()

        self.assertEqual(len(non_dominated), 10)  # test the number of non_dominated solutions
        self.assertEqual(compute_hypervolume(non_dominated, [0, 0]), 0.30882255276025106)  # test the hypervolume value
예제 #5
0
    def test_moead_dra(self):
        """Test MOEA/D algorithm with the random sps strategy"""
        delta = 0.9
        nr = 2

        moead = MoeadDRA(problem=self.rmnk,
                         max_evaluation=500,
                         number_of_objective=self.number_of_objective,
                         number_of_weight_neighborhood=self.number_of_weight_neighborhood,
                         aggregation_function=Tchebycheff,
                         number_of_crossover_points=self.number_of_crossover_points,
                         weight_file=self.weight_file50,
                         delta=delta,
                         number_of_replacement=nr
                         )

        non_dominated = moead.run()

        self.assertEqual(len(non_dominated), 9)  # test the number of non_dominated solutions
        self.assertEqual(compute_hypervolume(non_dominated, [0, 0]), 0.3429102682198655)  # test the hypervolume value
예제 #6
0
    def test_moead_delta_nr(self):
        """Test MOEA/D algorithm with parameters delta & nr"""
        delta = 0.9
        nr = 2

        moead = MoeadDeltaNr(problem=self.rmnk,
                             max_evaluation=self.number_of_evaluations,
                             number_of_objective=self.number_of_objective,
                             number_of_weight_neighborhood=self.number_of_weight_neighborhood,
                             number_of_crossover_points=self.number_of_crossover_points,
                             aggregation_function=Tchebycheff,
                             weight_file=self.weight_file,
                             delta=delta,
                             number_of_replacement=nr
                             )

        non_dominated = moead.run()

        self.assertEqual(len(non_dominated), 12)  # test the number of non_dominated solutions
        self.assertEqual(compute_hypervolume(non_dominated, [0, 0]), 0.3087417993003917)  # test the hypervolume value