diff --git a/linopy/solvers.py b/linopy/solvers.py index 2783e7b8..75ba14ae 100644 --- a/linopy/solvers.py +++ b/linopy/solvers.py @@ -482,7 +482,7 @@ def solve_problem_from_file( variables = {v.name for v in h.getVariables()} def get_solver_solution() -> Solution: - m = re.match(r"Optimal.* - objective value (\d+\.?\d*)$", first_line) + m = re.match(r"Optimal.* - objective value (-?\d+\.?\d*)$", first_line) if m and len(m.groups()) == 1: objective = float(m.group(1)) else: