Skip to content

Wrap captureCons and releaseCons#1221

Open
Joao-Dionisio wants to merge 2 commits into
masterfrom
expose-captureCons-releaseCons
Open

Wrap captureCons and releaseCons#1221
Joao-Dionisio wants to merge 2 commits into
masterfrom
expose-captureCons-releaseCons

Conversation

@Joao-Dionisio
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and Model.releaseCons() wrappers in the Cython layer.
  • Added a unit test covering basic usage and TypeError behavior.
  • Updated the type stub (scip.pyi) and CHANGELOG.md to 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.

Comment thread src/pyscipopt/scip.pxi
constraint to release

"""
PY_SCIP_CALL(SCIPreleaseCons(self._scip, &cons.scip_cons))
Comment thread src/pyscipopt/scip.pxi
Comment on lines +8588 to +8591
Parameters
----------
cons : Constraint
constraint to release
Comment thread tests/test_cons.py
# Pair capture+release: problem still holds its own capture, so this is safe.
m.captureCons(c)
m.releaseCons(c)

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