-
Notifications
You must be signed in to change notification settings - Fork 266
Support for AND-constraints #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Left out are |
There was a problem hiding this 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 support for AND-constraints by introducing new API functions and a test case to validate their behavior.
- Introduces functions to query the number of variables, list the variables, retrieve the resultant variable, check sorting, and perform sorting for AND constraints.
- Updates the changelog to include additional support for AND-constraints.
- Adds a new test case in tests/test_cons.py to verify the behavior of the new functions.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/test_cons.py | Added test_cons_and for verifying AND-constraint behavior |
src/pyscipopt/scip.pxi | New AND-constraint API functions implementation |
src/pyscipopt/scip.pxd | Extern declarations for new AND-constraint API functions |
CHANGELOG.md | Updated changelog with support for AND-constraints |
list of Variable | ||
|
||
""" | ||
cdef SCIP_VAR** _vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The allocated memory for _vars via malloc is immediately overwritten by the call to SCIPgetVarsAnd, which may lead to a memory leak. Consider removing the malloc call and directly assigning the return value from SCIPgetVarsAnd.
Copilot uses AI. Check for mistakes.
What's missing:
SCIPchgAndConsCheckFlagWhenUpgr()
,SCIPchgAndConsRemovableFlagWhenUpgr()
. Not sure if it makes sense to add.As before, I haven't tried to compile, I just copied stuff.
Also moved things around a bit, I think it makes more sense to join methods by constraint handler, like in SCIP's documentation.