From 9d01890e1f3b7754c86627d903b8c4872b4032fe Mon Sep 17 00:00:00 2001 From: come-bissuel <25949239+come-bissuel@users.noreply.github.com> Date: Thu, 20 Feb 2025 07:57:16 +0100 Subject: [PATCH] Adding xpress postsolve if necessary --- linopy/solvers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linopy/solvers.py b/linopy/solvers.py index 2b27ce4c..c52cd7be 100644 --- a/linopy/solvers.py +++ b/linopy/solvers.py @@ -1478,6 +1478,10 @@ def solve_problem_from_file( m.solve() + # if the solver is stopped (timelimit for example), postsolve the problem + if m.getAttrib("solvestatus") == xpress.solvestatus_stopped: + m.postsolve() + if basis_fn is not None: try: m.writebasis(path_to_string(basis_fn))