-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support Logical Complements #118
Conversation
Later on, we could add the syntax: @variable(model, Y1, Logical)
@variable(model, Y2 == ¬Y1, Logical) to make it more symbolic, but that can wait for another PR. |
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 great. Thanks for putting this together. Added some minor comments. We can merge after they are addressed.
Thanks, I have addressed the comments. The restriction on not specifying the fix or start value is to avoid conflicts with the variable it is the complement of. |
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.
I think it would be better to say "Fix its logical complement instead". Using "Try" makes it sound like that might not work. Also complement should be spelled with an e
everywhere (not an i
...we don't like compliments XD)
Done. |
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.
Great. Thanks!
This PR closes #106. It does so by adding the
logical_complement
keyword argument when creating logical variables. For instance, we can have:These logical variables can then be used as normal to build disjunctions, but the underlying binary expressions avoid adding an unnecessary variable.
This works with all reformulations, but currently has the limitation that logical variables used inside nested disjunctions cannot be logical complements.