Return 2 offsprings in the position crossover

This commit is contained in:
coolneng 2021-06-17 22:45:14 +02:00
parent 49d8383133
commit 7c434fb9cd
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 3 additions and 2 deletions

View File

@ -104,8 +104,9 @@ def uniform_crossover(parents, m):
def position_crossover(parents, m):
matching_genes = get_matching_genes(parents)
shuffled_genes = select_random_genes(matching_genes, parents, m)
offspring = populate_offspring(values=[matching_genes, shuffled_genes])
return offspring
first_offspring = populate_offspring(values=[matching_genes, shuffled_genes])
second_offspring = populate_offspring(values=[matching_genes, shuffled_genes])
return [first_offspring, second_offspring]
def crossover(mode, parents, m):