From 1607a8dcd04f3ba917a57162b1e1bcbb10dd2767 Mon Sep 17 00:00:00 2001 From: Julian Blank Date: Thu, 16 Nov 2023 18:35:41 -0800 Subject: [PATCH] error in brkga pymoo implementation #499 --- pymoo/algorithms/soo/nonconvex/brkga.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pymoo/algorithms/soo/nonconvex/brkga.py b/pymoo/algorithms/soo/nonconvex/brkga.py index 2a6decd4f..5b3aed408 100755 --- a/pymoo/algorithms/soo/nonconvex/brkga.py +++ b/pymoo/algorithms/soo/nonconvex/brkga.py @@ -10,7 +10,6 @@ from pymoo.operators.crossover.binx import BinomialCrossover from pymoo.operators.mutation.nom import NoMutation from pymoo.operators.sampling.rnd import FloatRandomSampling -from pymoo.operators.selection.rnd import RandomSelection from pymoo.termination.default import DefaultSingleObjectiveTermination from pymoo.util.display.single import SingleObjectiveOutput from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting @@ -60,8 +59,8 @@ class EliteBiasedSelection(Selection): def _do(self, problem, pop, n_select, n_parents, **kwargs): _type = pop.get("type") - elites = np.where(_type == "elite")[0] - non_elites = np.where(_type == "non_elite")[0] + elites = np.where(_type == "elite")[0].astype(int) + non_elites = np.where(_type == "non_elite")[0].astype(int) # if through duplicate elimination no non-elites exist if len(non_elites) == 0: