diff --git a/pymoo/util/nds/fast_non_dominated_sort.py b/pymoo/util/nds/fast_non_dominated_sort.py index 43bfff37..3649e9ea 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 e6ab8e02..4c053c46 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 = []