Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Upcoming Version

**Bug Fixes**

* Fix the parsing of solutions returned by the CBC solver when solving from a file to not
assume that variables start with `x`.
* Fix the retrieval of solutions from the SCIP solver, and do not turn off presolve.

Version 0.5.2
Expand Down
7 changes: 6 additions & 1 deletion linopy/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ def solve_problem_from_file(
status = Status(SolverStatus.warning, TerminationCondition.unknown)
status.legacy_status = data

# Use HiGHS to parse the problem file and find the set of variable names, needed to parse solution
h = highspy.Highs()
h.readModel(path_to_string(problem_fn))
variables = {v.name for v in h.getVariables()}

def get_solver_solution() -> Solution:
objective = float(data[len("Optimal - objective value ") :])

Expand All @@ -467,7 +472,7 @@ def get_solver_solution() -> Solution:
usecols=[1, 2, 3],
index_col=0,
)
variables_b = df.index.str[0] == "x"
variables_b = df.index.isin(variables)

sol = df[variables_b][2]
dual = df[~variables_b][3]
Expand Down
Loading