Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Support for AND-constraints #980

wants to merge 5 commits into from

Conversation

Joao-Dionisio
Copy link
Member

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.

@Joao-Dionisio Joao-Dionisio marked this pull request as ready for review May 12, 2025 19:13
@Joao-Dionisio
Copy link
Member Author

Joao-Dionisio commented May 12, 2025

Left out are SCIPchgAndConsCheckFlagWhenUpgr and SCIPchgAndConsRemovableFlagWhenUpgr.

@Joao-Dionisio Joao-Dionisio self-assigned this May 12, 2025
@Joao-Dionisio Joao-Dionisio requested a review from Copilot May 12, 2025 19:14
Copy link

@Copilot 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 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
Copy link
Preview

Copilot AI May 12, 2025

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.

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.

1 participant