GeneticAlgorithmPython icon indicating copy to clipboard operation
GeneticAlgorithmPython copied to clipboard

Return value of pygad.GA.tournament_selection misleading

Open ahernandez105 opened this issue 3 years ago • 1 comments

The parent_indices returned by pygad.GA.tournament_selection are actually the best indices selected from the K rand_indices. Within this method parents_indices are updated as followed: parents_indices.append(selected_parent_idx)

where I believe it should be changed to: parents_indices.append(rand_indices[selected_parent_idx])

ahernandez105 avatar Feb 25 '22 22:02 ahernandez105

Yes, you are right. There was an issue returning the indices of the selected parents. But still the correct parents are returned because rand_indices[selected_parent_idx] is correctly used to return the selected parents in the last line of the for loop.

ahmedfgad avatar Feb 28 '22 00:02 ahmedfgad