Skip to content

Commit d987a81

Browse files
committed
add work-around problem in HiGHS' C API.
1 parent 7a26243 commit d987a81

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mip/highs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,9 @@ def constr_get_expr(self: "SolverHighs", constr: "mip.Constr") -> "mip.LinExpr":
621621
lower = ffi.new("double[]", 1)
622622
upper = ffi.new("double[]", 1)
623623
num_nz = ffi.new("int*")
624+
# TODO: We also pass a non-NULL matrix_start, which should not be
625+
# needed, but works around a known bug in HiGHS' C API.
626+
_tmp_matrix_start = ffi.new("int[]", 1)
624627
check(
625628
self._lib.Highs_getRowsByRange(
626629
self._model,
@@ -630,7 +633,7 @@ def constr_get_expr(self: "SolverHighs", constr: "mip.Constr") -> "mip.LinExpr":
630633
lower,
631634
upper,
632635
num_nz,
633-
ffi.NULL,
636+
_tmp_matrix_start,
634637
ffi.NULL,
635638
ffi.NULL,
636639
)

0 commit comments

Comments
 (0)