We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3fb7268 + 754c774 commit ef0805eCopy full SHA for ef0805e
mip/highs.py
@@ -1337,7 +1337,11 @@ def remove_constrs(self: "SolverHighs", constrsList: List[int]):
1337
1338
def constr_get_index(self: "SolverHighs", name: str) -> int:
1339
idx = ffi.new("int *")
1340
- self._lib.Highs_getRowByName(self._model, name.encode("utf-8"), idx)
+ status = self._lib.Highs_getRowByName(self._model, name.encode("utf-8"), idx)
1341
+ if status == STATUS_ERROR:
1342
+ # This means that no constraint with that name was found. Unfortunately,
1343
+ # Highs: getRowByName doesn't assign a value to idx in that case.
1344
+ return -1
1345
return idx[0]
1346
1347
# Variable-related getters/setters
0 commit comments