Skip to content
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

use floor and ceil to ensure int bounds #455

Merged
merged 1 commit into from
Mar 1, 2024
Merged

Conversation

Wout4
Copy link
Collaborator

@Wout4 Wout4 commented Mar 1, 2024

Bound calculations are not guaranteed to give integers, so convert before making an intvar

@Dimosts
Copy link
Collaborator

Dimosts commented Mar 1, 2024

Which bugs does this tackle? I also saw the same thing in PR #454, so I guess you encountered, but I am not sure which get_bounds can return non ints.

@Wout4
Copy link
Collaborator Author

Wout4 commented Mar 1, 2024

writing a constraint like x > 0.6 * y will get flattened to x > IV and IV == 0.6 * y.
We now get an error when creating IV, because it's precise bounds are float.

@Wout4
Copy link
Collaborator Author

Wout4 commented Mar 1, 2024

We decided before that it's better to leave the bound calculations exact, so they are not guaranteed to return integers.
For now this example will crash ortools anyway, but better to fix it on our side ofcourse (and with #454 you can indeed make it work on ortools)

@Wout4 Wout4 merged commit f038263 into master Mar 1, 2024
1 check passed
@tias
Copy link
Collaborator

tias commented Mar 1, 2024

One more thing; can you check whether it is non-integer, and in that case throw a warning? or is that excessive?

@Wout4
Copy link
Collaborator Author

Wout4 commented Mar 1, 2024

I don't think there will ever be a surprise float appearing without the user writing it? Maybe a warning that we only have intvars and not realvars makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants