Skip to content

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

@Joao-Dionisio

Description

@Joao-Dionisio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions