scipopt / PySCIPOpt

Python interface for the SCIP Optimization Suite
https://pyscipopt.readthedocs.io/en/latest/
MIT License
813 stars 252 forks source link

Segfault when using reoptimization and concurrent solving #884

Open waweber opened 2 months ago

waweber commented 2 months ago

Describe the bug A segfault occurs during reoptimization when using concurrent solving.

To Reproduce Run this program:

from pyscipopt import Model

model = Model()
x = model.addVar(lb=0.0, ub=10.0)
y = model.addVar(lb=0.0, ub=10.0)
z = x + y
model.addCons(y >= 2*x)
model.setObjective(z, "maximize")

model.enableReoptimization()
model.solveConcurrent()

print(f"x = {model.getVal(x)}")
print(f"y = {model.getVal(y)}")
print(f"z = {model.getVal(z)}")

model.freeReoptSolve()

model.addCons(x <= 3)
model.solveConcurrent()

print(f"x = {model.getVal(x)}")
print(f"y = {model.getVal(y)}")
print(f"z = {model.getVal(z)}")

The issue occurs with any combination of solving methods that uses solveConcurrent()

Expected behavior The program runs the same way as when normal model.optimize() is called.

System

Additional context Not 100% sure if this is from PySCIPOpt or a bug in SCIP itself

Joao-Dionisio commented 2 months ago

Hey @waweber! Apologies for the delay, August-time is always difficult.

Are there any updates on this? You can use solveConcurrent normally if you don't reoptimize, right?

waweber commented 2 months ago

Correct, I can use solveConcurrent without reoptimization, or reoptimize without solveConcurrent, but not both.

Notably, if I use solveConcurrent on the initial optimization, then use the single threaded optimize when reoptimizing, it also segfaults.