Skip to content

Commit

Permalink
solvers: add solution_fn for copt
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianHofmann committed Jul 9, 2024
1 parent ad060ac commit f2a5c3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions linopy/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,12 @@ def run_copt(
except coptpy.CoptError as err:
logger.info("No model basis stored. Raised error: %s", err)

if solution_fn:
try:
m.write(path_to_string(solution_fn))
except coptpy.CoptError as err:
logger.info("No model solution stored. Raised error: %s", err)

condition = m.LpStatus if model.type in ["LP", "QP"] else m.MipStatus
termination_condition = CONDITION_MAP.get(condition, condition)
status = Status.from_termination_condition(termination_condition)
Expand Down

0 comments on commit f2a5c3f

Please sign in to comment.