Skip to content

Reject coefficient insertion only when the row or column is full. - #90

Closed
akifcorduk wants to merge 1 commit into
scipopt:mainfrom
akifcorduk:fix-change-coefficient-capacity-guard-main
Closed

Reject coefficient insertion only when the row or column is full.#90
akifcorduk wants to merge 1 commit into
scipopt:mainfrom
akifcorduk:fix-change-coefficient-capacity-guard-main

Conversation

@akifcorduk

Copy link
Copy Markdown

Fix inverted capacity guard in ConstraintMatrix::change_coefficient

Before inserting a coefficient, change_coefficient checks that the row and the column still have fill-in space, using end + 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 in SparseStorage::changeRow, or writes past the row's span when asserts are compiled out.

Compare end >= start instead, so only a genuinely full row or column is rejected.

Adds test/papilo/core/ConstraintMatrixTest.cpp with one case per side of the boundary; the full-row case aborts without the fix.

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.
@DominikKamp

Copy link
Copy Markdown
Contributor

Merged variant with equality conditions with 2f0308a, thanks for reporting!

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.

2 participants