diff --git a/pymoo/operators/crossover/nox.py b/pymoo/operators/crossover/nox.py index 38fee1a7..7485cb43 100644 --- a/pymoo/operators/crossover/nox.py +++ b/pymoo/operators/crossover/nox.py @@ -1,10 +1,12 @@ +import itertools + from pymoo.core.crossover import Crossover from pymoo.core.population import Population class NoCrossover(Crossover): - def __init__(self, *, n_parents=1, n_offsprings=1, prob=0.0, **kwargs): - super().__init__(n_parents, n_offsprings, prob, **kwargs) + def __init__(self, *, n_parents=1, prob=0.0, **kwargs): + super().__init__(n_parents, n_parents, prob, **kwargs) def do(self, problem, pop, *args, random_state, **kwargs): - return Population.create(*[random_state.choice(parents) for parents in pop]) + return Population.create(*itertools.chain.from_iterable(pop))