-
Notifications
You must be signed in to change notification settings - Fork 31
Fix constants in Xor #778
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?
Fix constants in Xor #778
Conversation
|
Looks good to me, waiting for the tests to finish. |
|
I was a bit too quick with adding the trivially true/false cases in simplify_bool. Can probably do with a re-review |
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.
Maybe a small change to the test suite.
Also some tests seem to be failing due to the simplification now resulting in different expressions after transformation. The hard-coded checks fail.
| elif lb == 1 == ub: | ||
| self.assertEqual(cp.Model(expr).solveAll(), total_vals) | ||
| else: | ||
| self.assertNotEqual(cp.Model(expr).solveAll(), total_vals) |
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.
use assertLess()?
What with assertMore(..., 0)?
Some changes to how we handle constants in Xor, fixing both #620 and #747
Trivially true comparisons are now simplified away during
simplify_bool, and we cannsimplify_boolon the decomposition of Xor.This is not needed for any other global constraint, as it is the only one that takes Boolean arguments.
(Actually also IfThenElse does, but it's decomposition uses
impliesconstraints, and the simplifications are built-in to that constructor)