Skip to content

Commit 10e272d

Browse files
authored
Merge pull request scipy#21565 from HaoZeke/newHighs
ENH: HiGHs re-integration
2 parents 6e6ccc7 + 89e9229 commit 10e272d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+765
-1818
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,3 @@ scipy/optimize/_group_columns.c
322322
scipy/optimize/cython_optimize/_zeros.c
323323
scipy/optimize/cython_optimize/_zeros.pyx
324324
scipy/optimize/lbfgsb/_lbfgsbmodule.c
325-
scipy/optimize/_highs/cython/src/_highs_wrapper.cxx
326-
scipy/optimize/_highs/cython/src/_highs_constants.cxx

.gitmodules

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
path = scipy/_lib/unuran
1010
url = https://github.com/scipy/unuran.git
1111
shallow = true
12-
[submodule "HiGHS"]
13-
path = scipy/_lib/highs
14-
url = https://github.com/scipy/highs
15-
shallow = true
1612
[submodule "scipy/_lib/boost_math"]
1713
path = scipy/_lib/boost_math
1814
url = https://github.com/boostorg/math.git
@@ -29,3 +25,10 @@
2925
[submodule "scipy/_lib/array_api_extra"]
3026
path = scipy/_lib/array_api_extra
3127
url = https://github.com/lucascolley/array-api-extra.git
28+
# All submodules used as a Meson `subproject` are required to be under the
29+
# subprojects/ directory - see:
30+
# https://mesonbuild.com/Subprojects.html#why-must-all-subprojects-be-inside-a-single-directory
31+
[submodule "subprojects/highs"]
32+
path = subprojects/highs
33+
url = https://github.com/scipy/HiGHs
34+
shallow = true

benchmarks/benchmarks/optimize_linprog.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
methods = [("highs-ipm", {}),
1818
("highs-ds", {})]
1919

20+
# TODO(rg): CI failures with GROW7 as of gh-21565
21+
# Can't be reproduced locally...
2022
problems = ['25FV47', '80BAU3B', 'ADLITTLE', 'AFIRO', 'AGG', 'AGG2', 'AGG3',
2123
'BANDM', 'BEACONFD', 'BLEND', 'BNL1', 'BNL2', 'BORE3D', 'BRANDY',
2224
'CAPRI', 'CYCLE', 'CZPROB', 'D2Q06C', 'D6CUBE', 'DEGEN2', 'DEGEN3',
2325
'DFL001', 'E226', 'ETAMACRO', 'FFFFF800', 'FINNIS', 'FIT1D',
2426
'FIT1P', 'FIT2D', 'FIT2P', 'GANGES', 'GFRD-PNC', 'GREENBEA',
25-
'GREENBEB', 'GROW15', 'GROW22', 'GROW7', 'ISRAEL', 'KB2', 'LOTFI',
27+
'GREENBEB', 'GROW15', 'GROW22', 'ISRAEL', 'KB2', 'LOTFI',
2628
'MAROS', 'MAROS-R7', 'MODSZK1', 'PEROLD', 'PILOT', 'PILOT4',
2729
'PILOT87', 'PILOT-JA', 'PILOTNOV', 'PILOT-WE', 'QAP8', 'QAP12',
2830
'QAP15', 'RECIPE', 'SC105', 'SC205', 'SC50A', 'SC50B', 'SCAGR25',
@@ -40,7 +42,8 @@
4042
'refinery', 'vol1', 'woodinfe']
4143

4244
if not is_xslow():
43-
enabled_problems = ['ADLITTLE', 'AFIRO', 'BLEND', 'BEACONFD', 'GROW7',
45+
# TODO(rg): CI failures with GROW7 as of gh-21565
46+
enabled_problems = ['ADLITTLE', 'AFIRO', 'BLEND', 'BEACONFD',
4447
'LOTFI', 'SC105', 'SCTAP1', 'SHARE2B', 'STOCFOR1']
4548
enabled_infeasible_problems = ['bgdbg1', 'bgprtr', 'box1', 'chemcom',
4649
'cplex2', 'ex72a', 'ex73a', 'forest6',

benchmarks/benchmarks/optimize_milp.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def setup(self, prob):
4848
self.integrality = integrality
4949

5050
def time_milp(self, prob):
51-
# TODO: fix this benchmark (timing out in Aug. 2023)
51+
# TODO: fix this benchmark (timing out in Aug. 2023); see gh-19389
5252
# res = milp(c=self.c, constraints=self.constraints, bounds=self.bounds,
5353
# integrality=self.integrality)
5454
# assert res.success
@@ -57,8 +57,9 @@ def time_milp(self, prob):
5757

5858
class MilpMagicSquare(Benchmark):
5959

60-
# TODO: re-add 6, timing out in Aug. 2023
61-
params = [[3, 4, 5]]
60+
# TODO: look at 5,6 - timing out and disabled in Apr'24 (5) and Aug'23 (6)
61+
# see gh-19389 for details
62+
params = [[3, 4]]
6263
param_names = ['size']
6364

6465
def setup(self, n):

doc/source/tutorial/optimize.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ Finally, we can solve the transformed problem using :func:`linprog`.
17311731
>>> bounds = [x0_bounds, x1_bounds, x2_bounds, x3_bounds]
17321732
>>> result = linprog(c, A_ub=A_ub, b_ub=b_ub, A_eq=A_eq, b_eq=b_eq, bounds=bounds)
17331733
>>> print(result.message)
1734-
The problem is infeasible. (HiGHS Status 8: model_status is Infeasible; primal_status is At lower/fixed bound)
1734+
The problem is infeasible. (HiGHS Status 8: model_status is Infeasible; primal_status is None)
17351735

17361736
The result states that our problem is infeasible, meaning that there is no solution vector that satisfies all the
17371737
constraints. That doesn't necessarily mean we did anything wrong; some problems truly are infeasible.

mypy.ini

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,7 @@ ignore_errors = True
291291
[mypy-scipy.optimize._linprog_highs]
292292
ignore_errors = True
293293

294-
[mypy-scipy.optimize._highs.highs_wrapper]
295-
ignore_errors = True
296-
297-
[mypy-scipy.optimize._highs.constants]
294+
[mypy-scipy.optimize._highspy.*]
298295
ignore_errors = True
299296

300297
[mypy-scipy.optimize._trustregion]

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ tracker = "https://github.com/scipy/scipy/issues"
124124
[tool.doit]
125125
dodoFile = "dev.py"
126126

127+
[tool.meson-python.args]
128+
install = ['--skip-subprojects']
127129

128130
[tool.cibuildwheel]
129131
skip = "cp36-* cp37-* cp38-* pp* *_ppc64le *_i686 *_s390x"

scipy/_lib/_highs_utils.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

scipy/_lib/highs

Lines changed: 0 additions & 1 deletion
This file was deleted.

scipy/_lib/meson.build

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ fs = import('fs')
22
if not fs.exists('boost_math/README.md')
33
error('Missing the `boost` submodule! Run `git submodule update --init` to fix this.')
44
endif
5-
if not fs.exists('highs/README.md')
6-
error('Missing the `highs` submodule! Run `git submodule update --init` to fix this.')
7-
endif
85
if not fs.exists('unuran/README.md')
96
error('Missing the `unuran` submodule! Run `git submodule update --init` to fix this.')
107
endif

0 commit comments

Comments
 (0)