Skip to content

Adding stage checks to all the methods #1050

@Joao-Dionisio

Description

@Joao-Dionisio

For a long time, we've had problems related to calling methods outside the allowed Stages. (For more information on the stages, see here)
SCIP does the stage check internally, but only if it's compiled in Debug mode.

The following code seems to work:

m = Model()
m.restartSolve()

Even though restartSolve cannot be called in the PROBLEM stage.

With SCIP in debug mode, we get:

[debug.c:2345] ERROR: cannot call method <SCIPrestartSolve> in problem creation stage
[scip_solve.c:3660] ERROR: Error <-8> in function call

This needs to be fixed, as we cannot expect users to know about debug mode. (Issues in #1001, #907, #971, #610)

So, I think we need to add stage checks to all the methods. This is a lot of work, so it should be an ongoing process. For now, I'll just fix the issues I linked here, but I will keep the issue open for the other methods.

There is also a question of performance. If a user is adding 10 thousand variables in a loop, checking for the stage in all these variables seems a bit unnecessary. Perhaps we can have a global CHECK_STAGE variable which can be set/unset. Suggestions on how to deal with this are welcome.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions