Reject coefficient insertion only when the row or column is full. - #90
Closed
akifcorduk wants to merge 1 commit into
Closed
Reject coefficient insertion only when the row or column is full.#90akifcorduk wants to merge 1 commit into
akifcorduk wants to merge 1 commit into
Conversation
change_coefficient tested for missing fill-in space with end + 1 == start, which is true when exactly one spare slot remains and false when there is none. The last usable slot was therefore refused while a completely full row or column was let through, and changeRow then asserted on newsize <= rowranges[row + 1].start - rowranges[row].start. Compare end >= start instead, which rejects only the full case, and add a test for each side of the boundary.
Contributor
|
Merged variant with equality conditions with 2f0308a, thanks for reporting! |
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.
Fix inverted capacity guard in
ConstraintMatrix::change_coefficientBefore inserting a coefficient,
change_coefficientchecks that the row and the column still have fill-in space, usingend + 1 == start. That is true only when one spare slot remains, and false when there is none so the insertion is refused when it would have fit, and accepted when the row or column is full. The full case then trips the size assertion inSparseStorage::changeRow, or writes past the row's span when asserts are compiled out.Compare
end >= startinstead, so only a genuinely full row or column is rejected.Adds
test/papilo/core/ConstraintMatrixTest.cppwith one case per side of the boundary; the full-row case aborts without the fix.