fitnesses
This commit is contained in:
@@ -17,6 +17,9 @@ def crossover_subtree(
|
||||
child2 = parent2.copy()
|
||||
|
||||
# Выбираем случайные узлы, не включая корень
|
||||
if child1.root.get_depth() <= 1 or child2.root.get_depth() <= 1:
|
||||
return child1, child2
|
||||
|
||||
cut1 = random.choice(child1.root.list_nodes()[1:])
|
||||
cut2 = random.choice(child2.root.list_nodes()[1:])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user