scipy: BUG: optimize.milp: segfault from HiGHS
Describe your issue.
Ran across a simple test case where many problems like the test case are used in production with no problems for years but the solver segmentation faults with this particular one. No output from the command line on verbose except
Running HiGHS 1.2.0 [date: 2021-07-09, git hash: n/a] Copyright © 2022 ERGO-Code under MIT licence terms Presolving model 29 rows, 231 cols, 1988 nonzeros Segmentation fault (core dumped) <
Reproducing Code Example
import scipy.optimize as opt
import numpy as np
import pickle
[c1, constraints, integrality, bounds] = pickle.load(open('test.pkl', 'rb'))
res = opt.milp(c=c1, constraints=constraints,
integrality=integrality, bounds=bounds, options={'disp':True})
print(res.x)
print('done')
Error message
$ python test_case_311.py
Running HiGHS 1.2.0 [date: 2021-07-09, git hash: n/a]
Copyright (c) 2022 ERGO-Code under MIT licence terms
Presolving model
29 rows, 231 cols, 1988 nonzeros
Segmentation fault (core dumped)
SciPy/NumPy/Python version and system information
Currently on anaconda with 3.11 python
>>> scipy.__version__
'1.11.4'
I have also tried on anaconda with python 3.13 with the same results.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17 (11 by maintainers)
Very odd: I’ve reproduced this in (Python and) C++
When this error occurs, in the function detectParallelRowsAndCols(), the expression
rowNz.index()is -1, which causes addToMatrix() to be called with col=-1. The value -1 is converted into the maximum unsigned integer, which is 18446744073709551615, which is bigger than the vector allocated for this.Here is the line and the context:
I don’t know why
rowNz.index()is -1.With python 3.13 and scipy 1.14.1. Same error.