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

Monitor how often each binary constraint rejects a proposal #166

Open
maxhully opened this issue Jul 12, 2018 · 6 comments
Open

Monitor how often each binary constraint rejects a proposal #166

maxhully opened this issue Jul 12, 2018 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@maxhully
Copy link
Contributor

We could have an alternative Validator that checks all the constraints and keeps Counters of how often each constraint is true/false.

@maxhully
Copy link
Contributor Author

This would be good for benchmarking/troubleshooting weird chain behavior.

@rdbliss rdbliss added the enhancement New feature or request label Jul 12, 2018
@pizzimathy pizzimathy self-assigned this Jul 17, 2018
@rdbliss
Copy link
Collaborator

rdbliss commented Jul 17, 2018

Implemented in #182, but creates big log files for lengthy runs. My plan was to instead track things with a dictionary in Validator since that should be pretty inexpensive. I haven't started this yet.

@apizzimenti Are you still working on this? If so, this morning's master has the first implementation. There was a little bit of talk on gitter about this as well. (I'll stay away from this unless you've moved on!)

@pizzimathy pizzimathy assigned pizzimathy and unassigned pizzimathy Jul 17, 2018
@pizzimathy
Copy link
Member

(Accidentally unassigned myself – oops)

I was going to take a look at it after work today, as it seemed reasonably low-priority and I have some stuff to tackle back in Iowa right now. I can take your idea on improving #182 and run with it a bit, though.

@rdbliss
Copy link
Collaborator

rdbliss commented Jul 17, 2018 via email

@zschutzman
Copy link
Contributor

Was just flipping through chain stuff and I saw this issue -- I have something kind of like this working. Currently, Validator checks against constraints in the order they're added to the constructor. This is good, because it lets me reject things which violate population balance (fast) before checking whether they're contiguous (kinda fast) before computing a bunch of eigenvalues (slow!). If you instead want to count the number of steps on which any of the checks fail, you need to run all of them, which slows things down if you have expensive constraints.

The implementation for sequential checks is really basic. I added
self.constraint_fails = {c : 0 for c in constraints}
to the constructor of Validator and replaced
return False
in __call__() with
self.constraint_fails[constraint] +=1
return False

The keys of the dictionary are the constraint function objects themselves, so there's no need to try to come up with key names for every constraint that might get passed through.

@maxhully
Copy link
Contributor Author

maxhully commented Dec 8, 2018

Awesome! That seems like the right way to do this. I can add it and merge it in sometime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants