Toy-Neural-Network-JS icon indicating copy to clipboard operation
Toy-Neural-Network-JS copied to clipboard

Fixed issue with ga.js poolSelection

Open papalotis opened this issue 7 years ago • 3 comments

The birds array needs to be shuffled, otherwise we go through the array from worse to best

papalotis avatar Jun 09 '18 12:06 papalotis

I feel like I'm missing something. From what I see, the original array is not sorted.

Versatilus avatar Jun 11 '18 06:06 Versatilus

The birds are pushed to the array when they "die". If we don't shuffle the array, then we will always consider the worst bird first, the second worst second and so forth

papalotis avatar Jun 11 '18 06:06 papalotis

We start out with two identical unsorted arrays, allBirds and activeBirds. As the birds die, they are removed from activeBirds. Once activeBirds is empty, a new generation is randomly generated from the still unsorted allBirds.

Versatilus avatar Jun 11 '18 18:06 Versatilus