Skip to content

Commit c46ef13

Browse files
authored
Revert "ENH: Use highspy in linprog"
1 parent 6757fda commit c46ef13

37 files changed

+1818
-498
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,5 @@ 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

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
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
1216
[submodule "scipy/_lib/boost_math"]
1317
path = scipy/_lib/boost_math
1418
url = https://github.com/boostorg/math.git
@@ -19,9 +23,3 @@
1923
[submodule "scipy/_lib/pocketfft"]
2024
path = scipy/_lib/pocketfft
2125
url = https://github.com/scipy/pocketfft
22-
# All submodules used as a Meson `subproject` are required to be under the
23-
# subprojects/ directory - see:
24-
# https://mesonbuild.com/Subprojects.html#why-must-all-subprojects-be-inside-a-single-directory
25-
[submodule "subprojects/highs"]
26-
path = subprojects/highs
27-
url = https://github.com/scipy/highs

LICENSES_bundled.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ License:
252252
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
253253

254254
Name: HiGHS
255-
Files: subprojects/highs/*
255+
Files: scipy/optimize/_highs/*
256256
License: MIT
257-
For details, see subprojects/highs/LICENCE
257+
For details, see scipy/optimize/_highs/LICENCE
258258

259259
Name: Boost
260260
Files: scipy/_lib/boost_math/*

benchmarks/benchmarks/optimize_milp.py

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

5858
class MilpMagicSquare(Benchmark):
5959

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]]
60+
# TODO: re-add 6, timing out in Aug. 2023
61+
params = [[3, 4, 5]]
6362
param_names = ['size']
6463

6564
def setup(self, n):

doc/source/tutorial/optimize.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ Finally, we can solve the transformed problem using :func:`linprog`.
15961596
>>> bounds = [x0_bounds, x1_bounds, x2_bounds, x3_bounds]
15971597
>>> result = linprog(c, A_ub=A_ub, b_ub=b_ub, A_eq=A_eq, b_eq=b_eq, bounds=bounds)
15981598
>>> print(result.message)
1599-
The problem is infeasible. (HiGHS Status 8: model_status is Infeasible; primal_status is None)
1599+
The problem is infeasible. (HiGHS Status 8: model_status is Infeasible; primal_status is At lower/fixed bound)
16001600

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

mypy.ini

+3-5
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,13 @@ ignore_errors = True
283283
[mypy-scipy.optimize._linprog_util]
284284
ignore_errors = True
285285

286-
[mypy-scipy.optimize._highs.highspy._highs]
286+
[mypy-scipy.optimize._linprog_highs]
287287
ignore_errors = True
288-
ignore_missing_imports = True
289288

290-
[mypy-scipy.optimize._highs.highspy._highs.simplex_constants]
289+
[mypy-scipy.optimize._highs.highs_wrapper]
291290
ignore_errors = True
292-
ignore_missing_imports = True
293291

294-
[mypy-scipy.optimize._milp]
292+
[mypy-scipy.optimize._highs.constants]
295293
ignore_errors = True
296294

297295
[mypy-scipy.optimize._trustregion]

pyproject.toml

-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ tracker = "https://github.com/scipy/scipy/issues"
119119
[tool.doit]
120120
dodoFile = "dev.py"
121121

122-
[tool.meson-python.args]
123-
install = ['--skip-subprojects']
124122

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

scipy/_lib/highs

Submodule highs added at 4a12295

scipy/_lib/meson.build

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ 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
58
if not fs.exists('unuran/README.md')
69
error('Missing the `unuran` submodule! Run `git submodule update --init` to fix this.')
710
endif

scipy/meson.build

+1-3
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,6 @@ Wno_switch = cc.get_supported_arguments('-Wno-switch')
342342
Wno_unused_label = cc.get_supported_arguments('-Wno-unused-label')
343343
Wno_unused_result = cc.get_supported_arguments('-Wno-unused-result')
344344
Wno_unused_variable = cc.get_supported_arguments('-Wno-unused-variable')
345-
Wno_unused_but_set_variable = cc.get_supported_arguments('-Wno-unused-but-set-variable')
346-
Wno_incompatible_pointer_types = cc.get_supported_arguments('-Wno-incompatible-pointer-types')
347345

348346
# C++ warning flags
349347
_cpp_Wno_cpp = cpp.get_supported_arguments('-Wno-cpp')
@@ -547,7 +545,6 @@ subdir('sparse')
547545
subdir('stats')
548546
subdir('fft')
549547
subdir('io')
550-
subdir('optimize')
551548
subdir('spatial')
552549
subdir('cluster')
553550
subdir('constants')
@@ -557,5 +554,6 @@ subdir('signal')
557554
subdir('interpolate')
558555
subdir('ndimage')
559556
subdir('odr')
557+
subdir('optimize')
560558
subdir('datasets')
561559
subdir('misc')

scipy/optimize/_highs/_highs_wrapper.py

-237
This file was deleted.

scipy/optimize/_highs/cython/__init__.py

Whitespace-only changes.

scipy/optimize/_highs/cython/src/HConfig.h

Whitespace-only changes.

0 commit comments

Comments
 (0)