Skip to content

Commit 77e973a

Browse files
committed
work around unexpected Highs_getColIntegrality error
1 parent c627797 commit 77e973a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mip/highs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,11 @@ def var_set_obj(self: "SolverHighs", var: "mip.Var", value: numbers.Real):
14321432
check(self._lib.Highs_changeColCost(self._model, var.idx, value))
14331433

14341434
def var_get_var_type(self: "SolverHighs", var: "mip.Var") -> str:
1435+
# Highs_getColIntegrality only works if some variable is not continuous.
1436+
# Since we want this method to always work, we need to catch this case first.
1437+
if self._num_int_vars == 0:
1438+
return mip.CONTINUOUS
1439+
14351440
var_type = ffi.new("int*")
14361441
check(self._lib.Highs_getColIntegrality(self._model, var.idx, var_type))
14371442
if var_type[0] not in self._highs_type_map:

0 commit comments

Comments
 (0)