Wrap captureCons and releaseCons#1221
Open
Joao-Dionisio wants to merge 2 commits into
Open
Conversation
a3084ce to
d0d1381
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Python-level wrappers for SCIP’s constraint reference counting so advanced users can explicitly capture/release constraints, and updates typing/tests/changelog accordingly.
Changes:
- Added
Model.captureCons()andModel.releaseCons()wrappers in the Cython layer. - Added a unit test covering basic usage and TypeError behavior.
- Updated the type stub (
scip.pyi) andCHANGELOG.mdto reflect the new API.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_cons.py | Adds a new test for captureCons()/releaseCons() and invalid input handling. |
| src/pyscipopt/scip.pyi | Exposes the new methods in the public type stub. |
| src/pyscipopt/scip.pxi | Implements the new wrappers around SCIPcaptureCons / SCIPreleaseCons. |
| CHANGELOG.md | Documents the newly added API methods under “Unreleased”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| constraint to release | ||
|
|
||
| """ | ||
| PY_SCIP_CALL(SCIPreleaseCons(self._scip, &cons.scip_cons)) |
Comment on lines
+8588
to
+8591
| Parameters | ||
| ---------- | ||
| cons : Constraint | ||
| constraint to release |
| # Pair capture+release: problem still holds its own capture, so this is safe. | ||
| m.captureCons(c) | ||
| m.releaseCons(c) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.