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

Skip to content

Conversation

sirenard
Copy link
Contributor

@sirenard sirenard commented Aug 5, 2025

No description provided.

@Joao-Dionisio
Copy link
Member

Let me know when you want a review. For now, it seems you need to import SCIP_PARAMSETTING

@sirenard
Copy link
Contributor Author

sirenard commented Aug 5, 2025

Should be good now, thank you !

@Joao-Dionisio Joao-Dionisio requested review from Copilot and Joao-Dionisio and removed request for Copilot August 6, 2025 18:37
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 two new methods to the Variable class for tracking branching statistics: getNBranchings() and getNBranchingsCurrentRun(). These methods provide access to SCIP's internal counters for how many times a variable's bounds have been changed due to branching decisions.

  • Implements getNBranchings() to get total branching count for a variable in a given direction
  • Implements getNBranchingsCurrentRun() to get branching count for the current solving run only
  • Adds corresponding SCIP C function declaration and comprehensive test coverage

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/pyscipopt/scip.pxd Declares the SCIP C function SCIPvarGetNBranchingsCurrentRun
src/pyscipopt/scip.pxi Implements both new Variable methods with proper documentation
tests/test_vars.py Adds test cases for both new methods and imports required constants
CHANGELOG.md Documents the addition of the new methods

@Joao-Dionisio
Copy link
Member

Can you please provide a more complex test, where the number of branchings is nonzero?

sirenard and others added 3 commits August 7, 2025 07:35
@sirenard
Copy link
Contributor Author

sirenard commented Aug 7, 2025

I have changed the tests. Now they solve a MIP before testing that the sum of branchings for all the variables is correct.

@Joao-Dionisio
Copy link
Member

Thank you! Will just disable restarts, since future SCIP versions can change the number of restarts.

By the way, with suggestions you can just press "commit suggestion" and it's easier for both you and me :)

@Joao-Dionisio Joao-Dionisio merged commit 7b55a7b into scipopt:master Aug 7, 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