CyLP
CyLP copied to clipboard
`SIGSEGV` when choosing pivoting rule
I'm trying to run the example
from cylp.cy import CyClpSimplex
from cylp.py.pivots import DantzigPivot
# Get the path to a sample mps file
f = "cylp_/input/p0033.mps"
s = CyClpSimplex()
s.readMps(f) # Returns 0 if OK
pivot = DantzigPivot(s) # comment this line and
s.setPivotMethod(pivot) # this line, it will be OK.
s.primal()
round(s.objectiveValue, 5)
But it gives the log
Coin0001I At line 15 NAME P0033
Coin0001I At line 16 ROWS
Coin0001I At line 34 COLUMNS
Coin0001I At line 109 RHS
Coin0001I At line 118 BOUNDS
Coin0001I At line 152 ENDATA
Coin0002I Problem P0033 has 16 rows, 33 columns and 98 elements
Clp0027I Model was imported from cylp_/input/p0033.mps in 0.000132 seconds
Clp0006I 0 Obj 0 Primal inf 18.492499 (10) Dual inf 5.5987499e+11 (32)
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
However, if I comment the code which changes pivoting rules, the result is fine.
I have tried to change my python version in 3.7-3.9
and Cylp 0.91.4-0.91.5
and all other pivoting rules, but all of them gives the same result.
Here is my environment:
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2022.12.7 ha878542_0 conda-forge
coin-or-cbc 2.10.8 h3786ebc_0 conda-forge
coin-or-cgl 0.60.6 h6f57e76_2 conda-forge
coin-or-clp 1.17.7 hc56784d_2 conda-forge
coin-or-osi 0.108.7 h2720bb7_2 conda-forge
coin-or-utils 2.11.6 h202d8b1_2 conda-forge
cylp 0.91.5 pypi_0 pypi
cython 0.29.32 py37hd23a5d3_0 conda-forge
ld_impl_linux-64 2.40 h41732ed_0 conda-forge
libblas 3.9.0 16_linux64_openblas conda-forge
libcblas 3.9.0 16_linux64_openblas conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 12.2.0 h65d4601_19 conda-forge
libgfortran-ng 12.2.0 h69a702a_19 conda-forge
libgfortran5 12.2.0 h337968e_19 conda-forge
libgomp 12.2.0 h65d4601_19 conda-forge
liblapack 3.9.0 16_linux64_openblas conda-forge
liblapacke 3.9.0 16_linux64_openblas conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libopenblas 0.3.21 pthreads_h78a6416_3 conda-forge
libsqlite 3.40.0 h753d276_0 conda-forge
libstdcxx-ng 12.2.0 h46fd767_19 conda-forge
libzlib 1.2.13 h166bdaf_4 conda-forge
ncurses 6.3 h27087fc_1 conda-forge
numpy 1.21.6 py37h976b520_0 conda-forge
openssl 3.1.0 h0b41bf4_0 conda-forge
pip 23.0.1 pyhd8ed1ab_0 conda-forge
pkg-config 0.29.2 h36c2ea0_1008 conda-forge
python 3.7.12 hf930737_100_cpython conda-forge
python_abi 3.7 3_cp37m conda-forge
readline 8.2 h8228510_1 conda-forge
scipy 1.7.3 py37hf2a6cf1_0 conda-forge
setuptools 67.6.1 pyhd8ed1ab_0 conda-forge
sqlite 3.40.0 h4ff8645_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
wheel 0.40.0 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
My OS is: Ubuntu 22.04.2 LTS
You might take a look at #105 . I spent a good amount of time trying to run this down. The bug was introduced when trying to fix a memory leak and undoing that fix makes this bug go away, but that is not a long-term fix. It's not clear to me what the right fix is, but you can have a look at the situation. I assume this is what you're running into.
Thanks. Comment this line in the generated cpp file fixs the problem.
result = PyEval_EvalFrameEx(f,0);
++tstate->recursion_depth;
// Py_DECREF(f);
--tstate->recursion_depth;
Yes, just be aware that this introduces a memory leak, which may or may not affect your use case.