fix: skip already-inactive columns in remove_empty_cols() to avoid double-counted obj_offset - #53
Merged
Conversation
dance858
approved these changes
Aug 7, 2026
Owner
|
Awesome! Very nice catch and neat solution. Many thanks for this contribution. |
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.
Problem
remove_empty_cols() in src/explorers/SimpleReductions.c can add c[k] * val to obj->offset more than once for the same column, causing the reported objective to be too large by a constant. The postsolved primal/dual solution is unaffected only the offset bookkeeping is wrong.
Root cause: execute_substitution() in DtonsEq.c appends a column to state->empty_cols whenever its size drops to zero. The two guards at the append site are asserts, so in an NDEBUG build a column that has already been fixed can still be appended -- and can be appended more than once -- because remove_dton_eq_rows() defers delete_fixed_cols_from_problem() until after its doubleton loop. When remove_empty_cols() later iterates over the list, it processes each entry without checking whether the column was already handled, accumulating c[k]*val into the offset and emitting a FIXED_COL postsolve record each time.
Observed on a large LP (4.79M rows / 15.07M cols / 47.6M nnz):
The reduced problem is bit-identical before and after; only the offset accumulation changes.
Fix
Skip columns that are already tagged C_TAG_INACTIVE at the top of the loop in remove_empty_cols(). The first pass through the loop tags the column FIXED, so a duplicate entry is silently ignored on the second pass.