Skip to content

Commit 6c1d754

Browse files
authored
fix: correct regex to capture negative objective values when using CBC (#540)
Currently returns np.nan if objective function value solved by CBC is negative
1 parent 03bdd65 commit 6c1d754

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

linopy/solvers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def solve_problem_from_file(
550550
variables = {v.name for v in h.getVariables()}
551551

552552
def get_solver_solution() -> Solution:
553-
m = re.match(r"Optimal.* - objective value (\d+\.?\d*)$", first_line)
553+
m = re.match(r"Optimal.* - objective value (-?\d+\.?\d*)$", first_line)
554554
if m and len(m.groups()) == 1:
555555
objective = float(m.group(1))
556556
else:

0 commit comments

Comments
 (0)