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

Is CrossUniformFloat64 correct? #46

Closed
spakin opened this issue Nov 13, 2020 · 3 comments
Closed

Is CrossUniformFloat64 correct? #46

spakin opened this issue Nov 13, 2020 · 3 comments

Comments

@spakin
Copy link
Contributor

spakin commented Nov 13, 2020

I was just looking at the source code for CrossUniformFloat64, and I'm a bit puzzled by it. It assigns p1[i] a proportion of each of the old p1[i] and the old p2[i], but then it assigns p2[i] a proportion of each of the new p1[i] and the old p2[i]. Shouldn't it be using some intermediate variables to correctly distribute the parents' values to the children?

@MaxHalford
Copy link
Owner

Hey there @spakin! I don't work on eaopt actively anymore, and I don't have the bandwidth to look into this at the present time. The best thing to do would be to check yourself and/or write some kind of unit test :)

@spakin
Copy link
Contributor Author

spakin commented Nov 14, 2020

@MaxHalford: I checked, and the problem is manifested by CrossUniformFloat64 not preserving the total value from parents to offspring. In pull request #47, the code first computes the two new values and then assigns them to p1[i] and p2[i]. I correspondingly updated the unit tests to check for the old, bad behavior.

@MaxHalford
Copy link
Owner

Cheers! Nice and sweet PR. It makes me want to give some love back to the library.

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