-
Notifications
You must be signed in to change notification settings - Fork 96
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
ModelCacheMixin does not handle extra_constraints correctly for min #324
Comments
I found a bug which I think it casued by the same issue: ModelCacheMixin takes a invalid solution from the cache. Reproducer:
Produced output:
|
@g-kouv When I run this directly with z3: It looks like something wonky is happening in Z3 here, printing out the input and output of
Which should be false mathematically unless I'm missing something obvious: https://www.wolframalpha.com/input?i=x-y%3E%3D4+and+y%3E0+and+x%3E%3D0+and+x%3C%3D3 |
Actually, I think that's the case. Adding the constraint |
Description
Calling
min
with non-empty extra constraints results in an incorrect value, because the expression is found in_min_exhausted
and cached results are incorrectly used to calculate the minimum.A simple reproducer:
The last line prints 3 even though the correct answer is 2.
A simple solution would skip checking
_min_exhausted
and using cached results when extra constraints are passed. A related bug seems to has been fixed previously in 9d4b861.The issue also seems to apply to
max
and possiblyeval
.Steps to reproduce the bug
No response
Environment
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: