Skip to content

Commit

Permalink
BUG: Fix gh-15888
Browse files Browse the repository at this point in the history
More of a dodge than a fix, but will essentially work with exceptions now.
  • Loading branch information
HaoZeke committed Jul 30, 2023
1 parent 604e7a2 commit 6ae3a81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scipy/optimize/_highs/cython/src/Highs.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cdef extern from "Highs.h":
cdef cppclass Highs:
HighsStatus passHighsOptions(const HighsOptions& options)
HighsStatus passModel(const HighsLp& lp)
HighsStatus run()
HighsStatus run() except +
HighsStatus setHighsLogfile(FILE* logfile)
HighsStatus setHighsOutput(FILE* output)
HighsStatus writeHighsOptions(const string filename, const bool report_only_non_default_values = true)
Expand Down
11 changes: 10 additions & 1 deletion scipy/optimize/_highs/cython/src/_highs_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,16 @@ def _highs_wrapper(
}

# Solve the LP
cdef HighsStatus run_status = highs.run()
cdef HighsStatus run_status = HighsStatusOK
try:
run_status = highs.run()
except Exception as e:
print(f"The problem is too large to be solved. Details: {e}")
return {
'status': -1, # Probably should be something else
'message': "The problem is too large to be solved.",
}

if run_status == HighsStatusError:
return {
'status': <int> highs.getModelStatus(),
Expand Down

0 comments on commit 6ae3a81

Please sign in to comment.