From 5a2bd2a1f67cfef5e9d15e51d64576be72742eb8 Mon Sep 17 00:00:00 2001 From: Julian Blank Date: Sun, 25 Aug 2024 14:54:26 -0700 Subject: [PATCH] Parameter fix related to Progresively interactive NSGA-II #634 --- pymoo/util/nds/fast_non_dominated_sort.py | 7 ++----- pymoo/util/nds/non_dominated_sorting.py | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pymoo/util/nds/fast_non_dominated_sort.py b/pymoo/util/nds/fast_non_dominated_sort.py index 43bfff376..3649e9ea4 100644 --- a/pymoo/util/nds/fast_non_dominated_sort.py +++ b/pymoo/util/nds/fast_non_dominated_sort.py @@ -4,13 +4,11 @@ def fast_non_dominated_sort(F, dominator=Dominator(), **kwargs): - - if "dominator" in kwargs: + if "dominator" in kwargs: M = Dominator.calc_domination_matrix(F) - else: + else: M = dominator.calc_domination_matrix(F) - # calculate the dominance matrix n = M.shape[0] @@ -70,4 +68,3 @@ def fast_non_dominated_sort(F, dominator=Dominator(), **kwargs): current_front = next_front return fronts - diff --git a/pymoo/util/nds/non_dominated_sorting.py b/pymoo/util/nds/non_dominated_sorting.py index e6ab8e029..4c053c462 100644 --- a/pymoo/util/nds/non_dominated_sorting.py +++ b/pymoo/util/nds/non_dominated_sorting.py @@ -6,11 +6,10 @@ class NonDominatedSorting: - def __init__(self, epsilon=None, method="fast_non_dominated_sort", dominator=Dominator()) -> None: + def __init__(self, epsilon=None, method="fast_non_dominated_sort") -> None: super().__init__() self.epsilon = epsilon self.method = method - self.dominator = dominator def do(self, F, return_rank=False, only_non_dominated_front=False, n_stop_if_ranked=None, **kwargs): F = F.astype(float) @@ -24,7 +23,7 @@ def do(self, F, return_rank=False, only_non_dominated_front=False, n_stop_if_ran if self.epsilon is not None: kwargs["epsilon"] = float(self.epsilon) - fronts = func(F, **dict(kwargs, dominator=self.dominator)) + fronts = func(F, **kwargs) # convert to numpy array for each front and filter by n_stop_if_ranked if desired _fronts = []