Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Joao-Dionisio
Copy link
Member

For some strange reason, I'm getting some segfaults on the tests, but it's inconsistent. Might be my local builds doing weird stuff.

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 adds the getConsVals method to retrieve coefficient values from constraint objects, generalizes the getRhs method to support knapsack constraints, and includes corresponding tests.

  • Implements getConsVals method for extracting coefficient values from arbitrary constraints that can be represented as single linear constraints
  • Extends getRhs method to handle knapsack constraints by returning their capacity
  • Adds comprehensive test coverage for the new getConsVals functionality

Reviewed Changes

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

File Description
src/pyscipopt/scip.pxd Adds external function declaration for SCIPgetConsVals
src/pyscipopt/scip.pxi Implements getConsVals method and extends getRhs for knapsack constraints
tests/test_cons.py Adds test_getConsVals function and additional assertion for knapsack constraint
CHANGELOG.md Documents the new features added in this release

@Joao-Dionisio
Copy link
Member Author

@danielyhwang check out this branch, if you're in a hurry

@danielyhwang
Copy link

I managed to get around this by doing as https://stackoverflow.com/questions/67828685/how-to-get-constraint-matrix-after-presolving-in-pyscipopt#67832364 recommended and preventing constraints with linear constraints being upgraded to more specific constraints.

param_dict = {"constraints/linear/upgrade/logicor" : False,
                      "constraints/linear/upgrade/indicator" : False,
                      "constraints/linear/upgrade/knapsack" : False,
                      "constraints/linear/upgrade/setppc" : False,
                      "constraints/linear/upgrade/xor" : False,
                      "constraints/linear/upgrade/varbound" : False
                      }
        model.setParams(param_dict)

@Joao-Dionisio Joao-Dionisio marked this pull request as draft July 24, 2025 16:15
@Joao-Dionisio Joao-Dionisio marked this pull request as ready for review July 24, 2025 17:23
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

Attention: Patch coverage is 72.72727% with 6 lines in your changes missing coverage. Please review.

Project coverage is 54.38%. Comparing base (6452ea6) to head (4d51139).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
src/pyscipopt/scip.pxi 72.72% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1033      +/-   ##
==========================================
+ Coverage   54.13%   54.38%   +0.25%     
==========================================
  Files          22       22              
  Lines        5045     5220     +175     
==========================================
+ Hits         2731     2839     +108     
- Misses       2314     2381      +67     

☔ 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

@DominikKamp DominikKamp left a comment

Choose a reason for hiding this comment

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

Otherwise, this is fine.

Joao-Dionisio and others added 2 commits July 24, 2025 21:57
@Joao-Dionisio
Copy link
Member Author

Ahh you meant that the warnings should show up in the pipelines, I see I see.

@Joao-Dionisio Joao-Dionisio merged commit 5eecd95 into master Jul 24, 2025
1 check passed
@Joao-Dionisio Joao-Dionisio deleted the generalize-getters branch August 7, 2025 09:02
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.

3 participants