PySCIPOpt icon indicating copy to clipboard operation
PySCIPOpt copied to clipboard

```GetObjVal``` can't be called, even though the model has solutions

Open Joao-Dionisio opened this issue 2 years ago • 0 comments

getObjVal, getVal are too strict in the stage checks. For example, the following code raises an error:

from pyscipopt import Model

m = Model()

x = m.addVar()
m.setObjective(x)

m.setParam("limits/solutions", 1)
m.optimize()

print("Stage: ", m.getStage())

print(m.getNSols())
print(m.getObjVal()) # crashes here, even though the model does have solutions

getObjVal is a PySCIPOpt-only function, but the SCIP functions it calls don't need the strict requirements that getObjVal has.

The fix is in PR #815, but I'm having some trouble with it.

Joao-Dionisio avatar May 05 '24 08:05 Joao-Dionisio