Skip to content

API: addMatrixCons supports ExprCons #1036

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

Merged
merged 20 commits into from
Aug 2, 2025

Conversation

Zeroto521
Copy link
Contributor

closes to #1034

@Joao-Dionisio Joao-Dionisio requested a review from Copilot July 27, 2025 07:45
@Joao-Dionisio
Copy link
Member

(it will take a little bit for me to be able to look into this)

Copilot

This comment was marked as outdated.

@Joao-Dionisio
Copy link
Member

@Zeroto521 can you edit your test so that addMatrixCons receives an ExprCons, but then the shape of the other arguments doesn't match?

Added comments to the test_catching_errors function in test_matrix_variable.py to clarify the purpose of each exception test case.
Added a test case to ensure addMatrixCons raises a ValueError when provided with an initial array of incorrect shape.
Copy link

codecov bot commented Jul 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.34%. Comparing base (6452ea6) to head (b3b4008).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1036      +/-   ##
==========================================
+ Coverage   54.13%   54.34%   +0.21%     
==========================================
  Files          22       23       +1     
  Lines        5045     5255     +210     
==========================================
+ Hits         2731     2856     +125     
- Misses       2314     2399      +85     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@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 extends the addMatrixCons method to accept both ExprCons and MatrixExprCons objects, providing more flexibility in constraint handling. The change allows scalar expression constraints to be passed to the matrix constraint function.

Key changes:

  • Modified addMatrixCons to accept both ExprCons and MatrixExprCons types
  • Updated tests to reflect the new API behavior
  • Updated documentation and changelog

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/pyscipopt/scip.pxi Updated addMatrixCons method signature and implementation to handle both constraint types
tests/test_matrix_variable.py Modified test cases to verify new functionality and updated method calls
CHANGELOG.md Added entry documenting the API change
Comments suppressed due to low confidence (1)

CHANGELOG.md:21

  • The method name should be consistently capitalized. It should be 'addMatrixCons' not 'AddMatrixCons' to match the actual method name.
- AddMatrixCons also accepts ExprCons.

@Joao-Dionisio Joao-Dionisio merged commit 8267aa4 into scipopt:master Aug 2, 2025
1 check passed
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