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

Use crate random choice for selecting samples by fitness #7

Open
StefanoD opened this issue Aug 21, 2016 · 6 comments
Open

Use crate random choice for selecting samples by fitness #7

StefanoD opened this issue Aug 21, 2016 · 6 comments

Comments

@StefanoD
Copy link

Is there an interest to use the crate random choice in order to select samples by their fitness?

It should be with a runtime of O(n) faster than the existing solution which sorts the samples (O (n * log n))

https://github.com/StefanoD/Rust_Random_Choice

@willi-kappler
Copy link
Owner

Yes that would be great! I'm currently cleaning up stuff in the develop branch which will lead to v0.3. Including your crate should be quite simple, I'll let you know how it worked.

@StefanoD
Copy link
Author

Great! Maybe you can include performance tests; before and after.

@willi-kappler
Copy link
Owner

It turns out to be a bit more difficult than expected: darwin-rs uses lower values for the fitness where as random choice uses higher values for better fitness. I could pass m - fitness where m is the fitness of the least fittest individual.

@StefanoD
Copy link
Author

Or you could modify the calculation of the fitness? What is the upper bound of the biggest value?
You could calculate it this way:

let fitness_high = MAX_VALUE - fitness_low;

@StefanoD
Copy link
Author

Oh, sorry. You wrote the exact same thing.

@willi-kappler
Copy link
Owner

No problem ;-)
I'll try it and let you know.

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