Skip to content

[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

Closed
wants to merge 0 commits into from

Conversation

jwood803
Copy link
Contributor

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.

@sfilipi
Copy link
Member

sfilipi commented Jun 15, 2018

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]))
Copy link
Member

@sfilipi sfilipi Jun 15, 2018

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

Copy link
Contributor Author

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.

Copy link
Member

@sfilipi sfilipi Jun 15, 2018

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)

Copy link
Contributor Author

@jwood803 jwood803 Jun 15, 2018

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

Copy link
Member

@sfilipi sfilipi Jun 15, 2018

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)

Copy link
Contributor Author

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.

@sfilipi
Copy link
Member

sfilipi commented Jun 15, 2018

There are a few other sweepers, inside the Algorithms folder, that override ProposeSweeps.
Taking a look to see whether they need the same filtering, and I'll update the comment. Probably they do.


In reply to: 397653603 [](ancestors = 397653603)

@jwood803
Copy link
Contributor Author

Took a shot at updating the KdoSweeper. The others I may need some guidance with as to what the best approach would be, though.

@jwood803
Copy link
Contributor Author

jwood803 commented Jun 18, 2018

Whoops! Looks like rebasing closed this. 😅

Probably for the best since #368 looks like a better fix. #Closed

@sfilipi
Copy link
Member

sfilipi commented Jun 18, 2018

Thank you for your contribution!


In reply to: 398200508 [](ancestors = 398200508)

@ghost ghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants