Skip to content

Commit c627797

Browse files
committed
check status on Highs_getColIntegrality (fail some tests)
1 parent b683804 commit c627797

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mip/highs.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@
678678
def check(status):
679679
if status == STATUS_ERROR:
680680
raise mip.InterfacingError("Unknown error in call to HiGHS.")
681+
return status
681682

682683

683684
class SolverHighs(mip.Solver):
@@ -1432,11 +1433,9 @@ def var_set_obj(self: "SolverHighs", var: "mip.Var", value: numbers.Real):
14321433

14331434
def var_get_var_type(self: "SolverHighs", var: "mip.Var") -> str:
14341435
var_type = ffi.new("int*")
1435-
ret = self._lib.Highs_getColIntegrality(self._model, var.idx, var_type)
1436+
check(self._lib.Highs_getColIntegrality(self._model, var.idx, var_type))
14361437
if var_type[0] not in self._highs_type_map:
1437-
raise ValueError(
1438-
f"Invalid variable type returned by HiGHS: {var_type[0]} (ret={ret})"
1439-
)
1438+
raise ValueError(f"Invalid variable type returned by HiGHS: {var_type[0]}.")
14401439
return self._highs_type_map[var_type[0]]
14411440

14421441
def var_set_var_type(self: "SolverHighs", var: "mip.Var", value: str):

0 commit comments

Comments
 (0)