Skip to content

Commit 3279d11

Browse files
authored
fix: correct regex to capture negative objective values when using CBC
Currently returns np.nan if objective function value solved by CBC is negative
1 parent c5c004e commit 3279d11

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linopy/solvers.py

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

484484
def get_solver_solution() -> Solution:
485-
m = re.match(r"Optimal.* - objective value (\d+\.?\d*)$", first_line)
485+
m = re.match(r"Optimal.* - objective value (-?\d+\.?\d*)$", first_line)
486486
if m and len(m.groups()) == 1:
487487
objective = float(m.group(1))
488488
else:

0 commit comments

Comments
 (0)