coin-or / coin-or/CyLP

Segfault when trying to add PreProcessing for cbcModel

Open
#124 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JetBrains MPS
Stars
192
Forks
70
PR merge metrics
No merged PRs in 30d

Description

I'm trying to run the example given for cbcModel, but adding a PreProcessing cut generator (full context: I was trying to solve a much bigger problem and running into the same issue as below). However, this is causing a segfault, and I have no idea how to start debugging this. I've encountered this with two separate builds of Cbc (one via `conda`, and one via `coinbrew`, all on Linux running within WSL). Here's the exact code:

```
import numpy as np
from cylp.cy import CyCbcModel, CyClpSimplex
from cylp.cy.CyCgl import CyCglPreProcess
from cylp.py.modeling.CyLPModel import CyLPModel, CyLPArray
model = CyLPModel()

x = model.addVariable('x', 3, isInt=True)
y = model.addVariable('y', 2)

A = np.matrix([[1., 2., 0],[1., 0, 1.]])
B = np.matrix([[1., 0, 0], [0, 0, 1.]])
D = np.matrix([[1., 2.],[0, 1]])
a = CyLPArray([5, 2.5])
b = CyLPArray([4.2, 3])
x_u= CyLPArray([2., 3.5])

model += A*x <= a
model += 2 <= B * x + D * y <= b
model += y >= 0
model += 1.1 <= x[1:3] <= x_u

c = CyLPArray([1., -2., 3.])
model.objective = c * x + 2 * y.sum()

s = CyClpSimplex(model)

cbcModel = s.getCbcModel()
cbcModel.addCutGenerator(CyCglPreProcess())
```

Result:
```
Segmentation fault (core dumped)
```

I hope that I'm just doing something really ignorant, but other cut generators don't cause the same issue. And from solving my problem using PuLP previously, I can see that the PreProcessing step substantially reduced the size of the problem before Cbc found the ultimate solution. Just throwing the model at Cbc without preprocessing definitely is not working.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.