-
Notifications
You must be signed in to change notification settings - Fork 23
fix: Sign error in greater_than constraint #334
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
fix: Sign error in greater_than constraint #334
Conversation
`greater_than(terms, rhs)` is implemented as `greater_than_or_equals(terms, rhs - 1)`, but should be `greater_than_or_equals(terms, rhs - 1)`. This is likely a copy-paste error from the implementation of `less_than`. Note: I've added a unit test saying that "x > 0" is not satisfiable for an integer variable x which is required to be 0. This feels like an odd test to have. I'm happy to remove or change it.
ImkoMarijnissen
left a comment
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 catch! Thank you for creating a PR with the fix and a test case as well.
I think this brings up a good point that our MiniZinc interface is quite well-tested, but that the Rust interface requires more testing.
I have some small comments about the test case, but other than that, it looks good!
4791f43 to
8d00c8b
Compare
ImkoMarijnissen
left a comment
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, thank you for making the changes!
It appears that the linting CI does not pass; once that is fixed, it should be good to go.
8d00c8b to
d34df48
Compare
Whoops, I must have forgotten to cargo fmt. CI is now passing. "Dismiss old reviews when re-requested" is still failing. I'm not entirely sure what this is, but given that the error code is 403, I assume this is something a repo owner has to handle. |
greater_than(terms, rhs)is implemented asgreater_than_or_equals(terms, rhs - 1), but should begreater_than_or_equals(terms, rhs + 1). This is likely a copy-paste error from the implementation ofless_than.Note: I've added a unit test saying that "x > 0" is not satisfiable for an integer variable x which is required to be 0. This feels like an odd test to have. I'm happy to remove or change it.