Fix matching genes selection

This commit is contained in:
coolneng 2021-06-19 20:22:39 +02:00
parent f71aa2e1e2
commit 150457cc8e
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 2 additions and 2 deletions

View File

@ -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 numpy.random import randint, choice, shuffle
from pandas import DataFrame from pandas import DataFrame
from math import ceil from math import ceil
@ -87,7 +87,7 @@ def repair_offspring(offspring, parents, m):
def get_matching_genes(parents): def get_matching_genes(parents):
first_parent = parents[0].point.values first_parent = parents[0].point.values
second_parent = parents[1].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): def populate_offspring(values):