From ebdbfc0166beff87f8676aec0843d3872da3c7a7 Mon Sep 17 00:00:00 2001 From: Peter Mitri Date: Thu, 23 Jan 2025 10:41:34 +0100 Subject: [PATCH] update dual status for specific case --- ortools/math_opt/solvers/xpress_solver.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ortools/math_opt/solvers/xpress_solver.cc b/ortools/math_opt/solvers/xpress_solver.cc index 6a3988da86..c2e18ceee7 100644 --- a/ortools/math_opt/solvers/xpress_solver.cc +++ b/ortools/math_opt/solvers/xpress_solver.cc @@ -495,9 +495,13 @@ SolutionStatusProto XpressSolver::getDualSolutionStatus() const { case XPRS_SOLSTATUS_FEASIBLE: return SOLUTION_STATUS_FEASIBLE; case XPRS_SOLSTATUS_INFEASIBLE: - // when primal is unbounded, XPRESS returns unbounded for dual also - case XPRS_SOLSTATUS_UNBOUNDED: return SOLUTION_STATUS_INFEASIBLE; + case XPRS_SOLSTATUS_UNBOUNDED: + // when primal is unbounded, XPRESS returns unbounded for dual also (known + // issue). this is a temporary workaround + return (xpress_lp_status_.primal_status == XPRS_LP_UNBOUNDED) + ? SOLUTION_STATUS_INFEASIBLE + : SOLUTION_STATUS_UNDETERMINED; case XPRS_SOLSTATUS_NOTFOUND: return SOLUTION_STATUS_UNDETERMINED; default: