Skip to content

Commit 8918708

Browse files
committed
include HiGHS as solvers in other (slow) tests
1 parent 3261dae commit 8918708

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

test/dbft_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from os import environ
55
from itertools import product
66
import pytest
7+
import mip.highs
78
from mip import (
89
Model,
910
BINARY,
@@ -13,13 +14,16 @@
1314
maximize,
1415
CBC,
1516
GUROBI,
17+
HIGHS,
1618
)
1719

1820
TOL = 1e-4
1921

2022
SOLVERS = [CBC]
2123
if "GUROBI_HOME" in environ:
2224
SOLVERS += [GUROBI]
25+
if mip.highs.has_highs:
26+
SOLVERS += [HIGHS]
2327

2428
# for each pair o N, tMax, the expected: (optimal, columns, rows, non-zeros)
2529
PDATA = {

test/examples_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
import importlib.machinery
99
import pytest
1010

11+
import mip.highs
12+
1113

1214
EXAMPLES = glob(join("..", "examples", "*.py")) + glob(join(".", "examples", "*.py"))
1315

1416
SOLVERS = ["cbc"]
1517
if "GUROBI_HOME" in environ:
1618
SOLVERS += ["gurobi"]
19+
if mip.highs.has_highs:
20+
SOLVERS += ["HiGHS"]
1721

1822

1923
@pytest.mark.parametrize("solver, example", product(SOLVERS, EXAMPLES))

test/mip_files_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from itertools import product
88
import pytest
99
import mip
10-
from mip import Model, OptimizationStatus, GUROBI, CBC
10+
import mip.highs
11+
from mip import Model, OptimizationStatus, GUROBI, CBC, HIGHS
1112

1213
# for each MIP in test/data, best lower and upper bounds
1314
# to be used when checking optimization results
@@ -89,6 +90,8 @@
8990
SOLVERS = [CBC]
9091
if "GUROBI_HOME" in environ:
9192
SOLVERS += [GUROBI]
93+
if mip.highs.has_highs:
94+
SOLVERS += [HIGHS]
9295

9396
# check availability of test data
9497
DATA_DIR = join(join(dirname(mip.__file__)[0:-3], "test"), "data")

test/mip_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
from itertools import product
33
import pytest
44
import networkx as nx
5+
import mip.highs
56
from mip import Model, xsum, OptimizationStatus, MAXIMIZE, BINARY, INTEGER
6-
from mip import ConstrsGenerator, CutPool, maximize, CBC, GUROBI, Column
7+
from mip import ConstrsGenerator, CutPool, maximize, CBC, GUROBI, HIGHS, Column
78
from os import environ
89
import math
910

@@ -12,6 +13,8 @@
1213
SOLVERS = [CBC]
1314
if "GUROBI_HOME" in environ:
1415
SOLVERS += [GUROBI]
16+
if mip.highs.has_highs:
17+
SOLVERS += [HIGHS]
1518

1619

1720
@pytest.mark.parametrize("solver", SOLVERS)

test/rcpsp_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import json
66
from itertools import product
77
import pytest
8-
from mip import CBC, GUROBI, OptimizationStatus
8+
import mip.highs
9+
from mip import CBC, GUROBI, HIGHS, OptimizationStatus
910
from mip_rcpsp import create_mip
1011

1112
INSTS = glob("./data/rcpsp*.json") + glob("./test/data/rcpsp*.json")
@@ -15,6 +16,8 @@
1516
SOLVERS = [CBC]
1617
if "GUROBI_HOME" in environ:
1718
SOLVERS += [GUROBI]
19+
if mip.highs.has_highs:
20+
SOLVERS += [HIGHS]
1821

1922

2023
@pytest.mark.parametrize("solver, instance", product(SOLVERS, INSTS))

test/two_dim_pack_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import json
66
from itertools import product
77
import pytest
8-
from mip import CBC, GUROBI, OptimizationStatus
8+
import mip.highs
9+
from mip import CBC, GUROBI, HIGHS, OptimizationStatus
910
from mip_2d_pack import create_mip
1011

1112
INSTS = glob("./data/two_dim_pack_p*.json") + glob(
@@ -17,6 +18,8 @@
1718
SOLVERS = [CBC]
1819
if "GUROBI_HOME" in environ:
1920
SOLVERS += [GUROBI]
21+
if mip.highs.has_highs:
22+
SOLVERS += [HIGHS]
2023

2124

2225
@pytest.mark.parametrize("solver, instance", product(SOLVERS, INSTS))

0 commit comments

Comments
 (0)