Avoid overflow in float interval medians#231
Merged
Merged
Conversation
652a74f to
b018bc7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An unbounded FlatZinc float variable can enter an all-negative interval whose median overflows to negative infinity. The split brancher then has one failing alternative and one alternative that leaves the domain unchanged, so search repeats indefinitely.
Compute finite medians with the existing nearest-rounding policy, scaling the operands only near the numerical limits to avoid overflow. Semi-infinite intervals retain their legacy extended endpoint, the fully unbounded interval has symmetric median zero, and singleton infinities remain unchanged.
Regression coverage includes positive, negative, and mixed intervals at the Float limits; the one-ULP closest-representation case; semi-infinite and infinite intervals; signed zero; and subnormal intervals. The reported model goes from 977,266 nodes without a solution after one second to 54 nodes and a solution in under one millisecond.
Checks:
Float::Basic(20 iterations)Float::Branchtests (20 iterations)fzn-gecode(1 solution, 54 nodes)git diff --checkCloses #164.