Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Sort check in neat getFittest and getParent #212

Closed
missionz3r0 opened this issue Mar 27, 2020 · 0 comments
Closed

Invalid Sort check in neat getFittest and getParent #212

missionz3r0 opened this issue Mar 27, 2020 · 0 comments

Comments

@missionz3r0
Copy link

As a precursor, I'm willing to make these changes myself. But want to make sure there is not a reason for these functions to be the way they are before doing so.

Description

Both getFittest and getParent have a check before sorting that checks to see if the first two items in the population are sorted against eachother. Not only does this not correctly check that the population is sorted, it will also cause and error if the population is 1.

This seems to have been an issue in neataptic as well.

wagenaartje/neataptic#137

Files

You can see this incorrect check here and here

To Reproduce

A call to getFittest or getParent will show the issue if the population is sorted in a particular way. Such that the first two items are "sorted" but the rest aren't. For example, if the scores are as follow. [15, 20, 1, 2, 3, 4, 100]

Tasks

Include specific tasks in the order they need to be done in. Include links to specific lines of code where the task should happen at.

  • Just call the sort in both functions rather than checking.
missionz3r0 pushed a commit to missionz3r0/carrot that referenced this issue Mar 27, 2020
Removed incorrect checks before sorting in getParent and getFittest.
@missionz3r0 missionz3r0 mentioned this issue Mar 27, 2020
christianechevarria added a commit to missionz3r0/carrot that referenced this issue Mar 27, 2020
christianechevarria pushed a commit that referenced this issue Mar 27, 2020
Removed incorrect checks before sorting in getParent and getFittest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants