Skip to content

Commit 34c2c36

Browse files
committed
add version check for highs in tests
1 parent 8124546 commit 34c2c36

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

pyomo/contrib/mindtpy/tests/test_mindtpy.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
QCP_model._generate_model()
5757
extreme_model_list = [LP_model.model, QCP_model.model]
5858

59-
required_solvers = ('ipopt', 'appsi_highs')
59+
if SolverFactory('appsi_highs').available(exception_flag=False) and SolverFactory(
60+
'appsi_highs'
61+
).version() >= (1, 7, 0):
62+
required_solvers = ('ipopt', 'appsi_highs')
63+
else:
64+
required_solvers = ('ipopt', 'glpk')
6065
if all(SolverFactory(s).available(exception_flag=False) for s in required_solvers):
6166
subsolvers_available = True
6267
else:

pyomo/contrib/mindtpy/tests/test_mindtpy_ECP.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@
2323
from pyomo.environ import SolverFactory, value
2424
from pyomo.opt import TerminationCondition
2525

26-
required_solvers = ('ipopt', 'appsi_highs')
26+
if SolverFactory('appsi_highs').available(exception_flag=False) and SolverFactory(
27+
'appsi_highs'
28+
).version() >= (1, 7, 0):
29+
required_solvers = ('ipopt', 'appsi_highs')
30+
else:
31+
required_solvers = ('ipopt', 'glpk')
32+
2733
if all(SolverFactory(s).available(exception_flag=False) for s in required_solvers):
2834
subsolvers_available = True
2935
else:

pyomo/contrib/mindtpy/tests/test_mindtpy_feas_pump.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
from pyomo.contrib.mindtpy.tests.feasibility_pump1 import FeasPump1
2929
from pyomo.contrib.mindtpy.tests.feasibility_pump2 import FeasPump2
3030

31-
required_solvers = ('ipopt', 'appsi_highs')
31+
if SolverFactory('appsi_highs').available(exception_flag=False) and SolverFactory(
32+
'appsi_highs'
33+
).version() >= (1, 7, 0):
34+
required_solvers = ('ipopt', 'appsi_highs')
35+
else:
36+
required_solvers = ('ipopt', 'glpk')
37+
3238
if all(SolverFactory(s).available(exception_flag=False) for s in required_solvers):
3339
subsolvers_available = True
3440
else:

pyomo/contrib/mindtpy/tests/test_mindtpy_grey_box.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@
1818
from pyomo.contrib.mindtpy.tests.MINLP_simple import SimpleMINLP as SimpleMINLP
1919

2020
model_list = [SimpleMINLP(grey_box=True)]
21-
required_solvers = ('cyipopt', 'glpk')
21+
22+
if SolverFactory('appsi_highs').available(exception_flag=False) and SolverFactory(
23+
'appsi_highs'
24+
).version() >= (1, 7, 0):
25+
required_solvers = ('cyipopt', 'appsi_highs')
26+
else:
27+
required_solvers = ('cyipopt', 'glpk')
28+
2229
if all(SolverFactory(s).available(exception_flag=False) for s in required_solvers):
2330
subsolvers_available = True
2431
else:

0 commit comments

Comments
 (0)