From 6d8e5400fd508ae297e28813395bd3957161e7f4 Mon Sep 17 00:00:00 2001 From: Lev Nachmanson Date: Mon, 13 Apr 2020 16:36:44 -0700 Subject: [PATCH] return an empty model when the status of the solver is neither FEASIBLE nor OPTIMAL Signed-off-by: Lev Nachmanson --- src/math/lp/lar_solver.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/math/lp/lar_solver.cpp b/src/math/lp/lar_solver.cpp index f8fdb7a11..cf201351d 100644 --- a/src/math/lp/lar_solver.cpp +++ b/src/math/lp/lar_solver.cpp @@ -1207,7 +1207,11 @@ void lar_solver::get_infeasibility_explanation_for_inf_sign( // (x, y) != (x', y') => (x + delta*y) != (x' + delta*y') void lar_solver::get_model(std::unordered_map & variable_values) const { - lp_assert(get_status() == lp_status::OPTIMAL || get_status() == lp_status::FEASIBLE); + if (!(get_status() == lp_status::OPTIMAL || get_status() == lp_status::FEASIBLE)) { + variable_values.clear(); + return; + } + lp_assert(m_mpq_lar_core_solver.m_r_solver.calc_current_x_is_feasible_include_non_basis()); variable_values.clear(); mpq delta = m_mpq_lar_core_solver.find_delta_for_strict_bounds(mpq(1, 2)); // start from 0.5 to have less clashes