-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[WIP] Update ProposeSweeps to have unique entries #358
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
Conversation
Thanks for helping @jwood803. Taking a look now. |
@@ -173,7 +177,12 @@ public override ParameterSet[] ProposeSweeps(int maxSweeps, IEnumerable<IRunResu | |||
if (!AlreadyGenerated(_cache[iPerm], prevParamSets)) | |||
break; | |||
} | |||
result.Add(_cache[iPerm]); | |||
|
|||
if(!_cache.Contains(_cache[iPerm])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_cache [](start = 20, length = 6)
did you mean to check if result Contains it? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, whoops! I think you are correct. I'll update that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this would avoid returning duplicates, which is good, but we'd still have duplicates stored in the _cache. Might be just good practice to avoid storing the result directly in the _cache
In reply to: 195774135 [](ancestors = 195774135)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably way off, but would something like this work when initializing the _cache
?
_cache = (new ParameterSet[_nGridPoints]).Distinct().ToArray();
``` #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not, because the values are generated later, by calling CreateParamSet.
In reply to: 195781506 [](ancestors = 195781506)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I'll just update to add only if it's contained in the cache.
There are a few other sweepers, inside the Algorithms folder, that override ProposeSweeps. In reply to: 397653603 [](ancestors = 397653603) |
Took a shot at updating the |
Whoops! Looks like rebasing closed this. 😅 Probably for the best since #368 looks like a better fix. #Closed |
Thank you for your contribution! In reply to: 398200508 [](ancestors = 398200508) |
Proposed fix for issue #215.
Updated the
ProposeSweeps
virtual and override methods to not add to the collection if it already exists to prevent duplicates.Put this as a work in progress PR since I'm sure I'll need some guidance as to if this solution is even a good one and how it can be further improved.
If anything else is needed, I'll be glad to update this PR.