From 221499e503ca02316619fb45dac99c72468eb1ec Mon Sep 17 00:00:00 2001 From: Geoffrey Pruvost Date: Fri, 4 Dec 2020 15:37:25 +0100 Subject: [PATCH 1/2] add param mutation_probability in moead algorithm --- moead_framework/algorithm/combinatorial/moead.py | 2 ++ .../core/offspring_generator/offspring_generator.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/moead_framework/algorithm/combinatorial/moead.py b/moead_framework/algorithm/combinatorial/moead.py index 18e3b89..7ea3537 100644 --- a/moead_framework/algorithm/combinatorial/moead.py +++ b/moead_framework/algorithm/combinatorial/moead.py @@ -15,6 +15,7 @@ def __init__(self, problem, weight_file, termination_criteria=None, number_of_crossover_points=2, + mutation_probability=1, mating_pool_selector=None, genetic_operator=None, parent_selector=None, @@ -39,6 +40,7 @@ def __init__(self, problem, offspring_generator=offspring_generator, weight_file=weight_file) self.number_of_crossover_points = number_of_crossover_points + self.mutation_probability = mutation_probability if genetic_operator is None: self.genetic_operator = CrossoverAndMutation diff --git a/moead_framework/core/offspring_generator/offspring_generator.py b/moead_framework/core/offspring_generator/offspring_generator.py index ca3f5b7..035d5a0 100644 --- a/moead_framework/core/offspring_generator/offspring_generator.py +++ b/moead_framework/core/offspring_generator/offspring_generator.py @@ -18,8 +18,14 @@ def run(self, population_indexes): else: crossover_point = None + if hasattr(self.algorithm, 'mutation_probability'): + mutation_probability = self.algorithm.mutation_probability + else: + mutation_probability = None + y_sol = self.algorithm.genetic_operator(solutions=parents_solutions, - crossover_points=crossover_point + crossover_points=crossover_point, + mutation_probability=mutation_probability ).run() return self.algorithm.problem.generate_solution(array=y_sol) From efb1982ce62ecaeeff13734ec8271818a684d991 Mon Sep 17 00:00:00 2001 From: Geoffrey Pruvost Date: Fri, 4 Dec 2020 15:38:07 +0100 Subject: [PATCH 2/2] fix 0.5.7.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f67c62b..941e142 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="moead-framework", - version="0.5.7", + version="0.5.7.1", author="Geoffrey Pruvost", author_email="geoffrey@pruvost.xyz", description="MOEA/D Framework in Python 3",