-
Notifications
You must be signed in to change notification settings - Fork 432
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
Add reusable counterpart of WeightedIndex #1459
Comments
Is there a reason this can't be a new method like The main limitations of adding this functionality to
The biggest limitation of your current approach that I see:
|
Yes, this is the main blocker, why I decided to make new implementation. I can not see how to make
I don't wait that this one-time object will require to store in other structs, because it's main target to create weighting fast, make one sampling and drop. If it is required to store object in other struct, then one can use |
Understood, however I have concerns:
|
Couldn't we just implement |
Background
What is your motivation?
There is not any effective
WeightedIndex
implementation, that does not require new allocation on heap to replace all weighted index values.WeightedIndex::update_weights
is only effective on updating small amount of weights.What type of application is this?
Tasks such as Travelling salesman problem for their heuristic and approximation solutions (for example, via Ant colony optimization) require single sampling on each of multiple instances of WeightedIndex with different weights.
Feature request
In commited pull request #1460 I'm trying to add
ReusableWeightedIndex
with reusable storage to prevent unnecessary allocationsThe text was updated successfully, but these errors were encountered: