-
Notifications
You must be signed in to change notification settings - Fork 30
Convert assumptions to list #712
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
base: master
Are you sure you want to change the base?
Conversation
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.
Looks good. But was wondering why we don't check if its an iterable instead? Something similar as is done in _flatten()
. Not that this would make any noticeable difference. Just a thought, pull request can be merged as is.
Hmm good point, from a user-perspective it might actually be nice if we just took care of any collection. |
I'm not convinced... we should have stricter typing, not weaker? e.g. this should be a List[BoolVarImpl_] or smth... if a user has a set, they should just do list({a,b})? Or it can be any Iterable, but 'flatten' means also nested lists? |
Hmm yeah explicitly typing this might indeed be the better option, we should check for it as well then and raise a proper error |
I'd be in favor of an On one hand, this is weaker typing than having On the other hand, this typing is stronger b/c it does not accept iterators over non-literals: e.g. the iterable should be "flat" (only generate literals, not suddenly generate lists!), because it's not clear what this means. An assumption is a literal, not a list. |
Also note: in this PR, please also remove |
Allows a user to post a
set
instead oflist
of assumption variables during the solve call.More of a user-experience improvement (personally also encountered this multiple times already) and fixes #689
Could be part of a larger discussion on what to do with sets in general, do we want to support them as if they were lists?
E.g., should
get_variables(some_set_of_constraints)
also work?