Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pymoo/operators/crossover/nox.py
Original file line number Diff line number Diff line change
@@ -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))
Loading