Closed guzuligo closed 3 years ago
Thanks for adding a PR @guzuligo ! :fireworks:
Would you be able to explain your thinking on the change a bit more?
Elitism selects the best members relative to the previous generation and so there's no guarantee that they will be the best in the current generation which is why they've been added to the end of the members array until now
Sure.
Have a look at the score. If you have like 5 elitist, you will notice that the fittest elitist is the 5th one.
The problem is when you are monitoring the progress and need to see the fittest one.
For example, I create several rooms where AI tries to do a certain task. If I set the elitism to 1, I just need to monitor the first. If in the middle of the training I decided to change the elitism to 10, I have to move the camera to the 10th to check the progress as the 10th is the one that made better progress in previous generation.
Using unshift simply guarantees that the one with the highest score in previous generation is at index zero, which saves me doing workarounds. 👍
Makes sense, all tests passed -- merging in!
Thanks again for contirbuting
By adding the elitist at the beginning, next generation will have the best at the beginning instead of being mixed up with the mutated ones.