Skip to content

SCIP 11: Support for exact solving - #1264

Open
Joao-Dionisio wants to merge 53 commits into
scip11from
exact-solving
Open

Joao-Dionisio wants to merge 53 commits into
scip11from
exact-solving

Conversation

@Joao-Dionisio

@Joao-Dionisio Joao-Dionisio commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

So that the eventual PR for SCIP 11 doesn't get too huge. Adding a lot of support for using exact SCIP.
@DominikKamp , can you please take a look at this? Does it work as you would expect?

Most of the LOC changes come from the docstrings of the added methods.

EDIT: Now have an ExactModel class that contains all the exact functionality. That way, we can separate people's concerns.

from pyscipopt import Model, ExactModel

m            = Model()
m_exact = ExactModel()

x            = m.addVar() # adds a normal SCIP variable
x_exact = m_exact.addVar() # adds a rational SCIP variable

@DominikKamp

DominikKamp commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Noticed three issues:

  • trySol() with free option does not use exact function
    Uses SCIPtrySolFree() instead of SCIPtrySolFreeExact().
    => Route the free=True branch to SCIPtrySolFreeExact(), reject free=False.

  • Rational memory leak when any creation fails
    For example in addVar(), addConsLinear(), and aggregateVars() if a later _createRational() and _createBound fails, earlier rationals leak.
    => Free in try and finally.

  • getRowLinear() docstring contradicts behavior
    Says "floating-point LP row" and "Returns: Row" but returns RowExact.
    => Fix the docstring to "exact LP row" and "Returns: RowExact".

The subclassing is good, but should rather be explicitly whitelisted for "safe" methods instead of automatically inherited to prevent future leaks, and remaining real methods should be clearly documented.

@Joao-Dionisio

Joao-Dionisio commented Nov 5, 2026 •

Copy link
Copy Markdown
Member Author

Thank you @DominikKamp !

SCIPtrySolFreeExact() is not yet a public function. I'll work on the other two.

On the subclassing, I'm not sure how the whitelisting would work. We can explicitly do

class ExactModel(Model):
    unsafe_method = None

We can also have

class BaseModel():
    def common_methods() ...

class Model(BaseModel):
    def unsafe_methods(): ....

class ExactModel(BaseModel):
    def exact_methods():...

This last option may be cleaner, but it's also a TON of risky changes. But fortune favors the brave, so I don't know if we should try 🤷

@DominikKamp

Copy link
Copy Markdown
Contributor

The unsafe_method = None approach would be blacklisting but whitelisting is required for addition safety (analogous to the exact flags in SCIP). The BaseModel would be the whitelist and therefore sounds preferable.

@Joao-Dionisio Joao-Dionisio changed the title Support for exact solving SCIP 11: Support for exact solving Nov 12, 2026
@Joao-Dionisio

Copy link
Copy Markdown
Member Author

This should be merged after #1292 . Then, the diff should become much nicer.

@Joao-Dionisio Joao-Dionisio added this to the v7.0.0 milestone Nov 15, 2026
Joao-Dionisio and others added 18 commits November 15, 2026 17:19
# Conflicts:
#	src/pyscipopt/scip.pxi
#	src/pyscipopt/scip.pyi
…te/read to BaseModel, fix deprecation stacklevel and version

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants