Xpress: empty bound check not working -- fixed#5158
Open
Tahira-2 wants to merge 1 commit intogoogle:mainfrom
Open
Xpress: empty bound check not working -- fixed#5158Tahira-2 wants to merge 1 commit intogoogle:mainfrom
Tahira-2 wants to merge 1 commit intogoogle:mainfrom
Conversation
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.
Title: Xpress: handle empty integer bounds (fixes #5085)
Problem
The MathOpt parametrised test FractionalBoundsContainNoInteger skipped Xpress because integer variables with unrounded bounds like [0.5, 0.6] are rejected by Xpress at variable creation: Xpress rounds the bounds on input, sees [1, 0], and refuses to add the column. SCIP, GLPK, and HiGHS instead return TerminationReason::kInfeasible.
Fix
Mirrors GLPK's EmptyIntegerBoundsResult() pattern:
In AddNewVariables, detect integer variables where lb <= ub && ceil(lb) > floor(ub). For those, substitute [0, 0] in the bounds passed to Xpress (so it accepts the column) and remember the original bounds in a new empty_integer_bounds_vars_ member.
In Solve(), after the existing ListInvertedBounds check, short-circuit with ResultForIntegerInfeasible(...) if any such variable was recorded — without invoking the optimizer. The original lb/ub flow into the user-facing detail message.
Remove the GTEST_SKIP for kXpress in the test.
Files touched
ortools/math_opt/solvers/xpress_solver.{h,cc} — detection + early-return
ortools/math_opt/solvers/BUILD.bazel — added //ortools/math_opt/core:empty_bounds dep
ortools/math_opt/solver_tests/mip_tests.cc — re-enable the test for Xpress
CMake's solver target is built via a recursive glob, so no CMake change is needed.
Test plan
CI: compile + run all non-Xpress solver tests (covered automatically)
Local Xpress run of FractionalBoundsContainNoInteger — needs an Xpress license; cc @Mizux for verification