diff --git a/src/genetic_algorithm.py b/src/genetic_algorithm.py index cae5eb1..9fab9b3 100644 --- a/src/genetic_algorithm.py +++ b/src/genetic_algorithm.py @@ -1,4 +1,4 @@ -from numpy import sum, append, arange, delete, where +from numpy import sum, append, arange, delete, intersect1d from numpy.random import randint, choice, shuffle from pandas import DataFrame from math import ceil @@ -87,7 +87,7 @@ def repair_offspring(offspring, parents, m): def get_matching_genes(parents): first_parent = parents[0].point.values second_parent = parents[1].point.values - return where(first_parent == second_parent)[0] + return intersect1d(first_parent, second_parent) def populate_offspring(values):