Skip to content

Commit 8799ede

Browse files
committed
Skip other unnecessary HiGHS tests
1 parent 775b6e1 commit 8799ede

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

examples/gen_cuts_mip.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
"""This example reads a MIP (in .lp or .mps), solves its linear programming
22
relaxation and then tests the impact of adding different types of cutting
3-
planes. In the end, the it informs which cut generator produced the best bound
4-
improvement."""
3+
planes. In the end, it informs which cut generator produced the best bound
4+
improvement.
5+
"""
56

67
from textwrap import shorten
7-
import sys
88
from mip import Model, CutType, OptimizationStatus
99
import mip
1010

11-
lp_path = ""
12-
1311
# using test data
1412
lp_path = mip.__file__.replace("mip/__init__.py", "test/data/1443_0-9.lp").replace(
1513
"mip\\__init__.py", "test\\data\\1443_0-9.lp"
1614
)
1715

1816
m = Model()
19-
if m.solver_name.upper() in ["GRB", "GUROBI"]:
20-
print("This feature is currently not supported in Gurobi.")
17+
if m.solver_name.upper() != mip.CBC:
18+
print("This feature is currently supported only in CBC.")
2119
else:
2220
m.read(lp_path)
2321

@@ -55,8 +53,8 @@
5553
best_cut = ct
5654

5755
print(
58-
"Linear programming relaxation bound now: %g, improvement of %.2f"
59-
% (m2.objective_value, perc_impr)
56+
f"Linear programming relaxation bound now: "
57+
f"{m2.objective_value:.2f}, improvement of {perc_impr:.2f}"
6058
)
6159
else:
6260
continue

mip/highs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,12 @@ def optimize(
448448

449449
check(self._lib.Highs_run(self._model))
450450

451+
# check whether unsupported callbacks were set
452+
if self.model.lazy_constrs_generator:
453+
raise NotImplementedError("HiGHS doesn't support lazy constraints at the moment")
454+
if self.model.cuts_generator:
455+
raise NotImplementedError("HiGHS doesn't support cuts generator at the moment")
456+
451457
# store solution values for later access
452458
opt_status = self.get_status()
453459
if opt_status in (

test/numpy_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import time
2+
13
import numpy as np
4+
25
from mip import Model, OptimizationStatus
36
from mip.ndarray import LinExprTensor
4-
import time
5-
67
from util import skip_on
78

89

10+
@skip_on(NotImplementedError)
911
def test_numpy():
1012
model = Model()
11-
N = 1000
13+
N = 100
1214

1315
start = time.time()
1416
x = model.add_var_tensor(shape=(N, N), name="x")

0 commit comments

Comments
 (0)