Skip to content

Commit 258f9bf

Browse files
Interface SCIPgetNLPBranchCands (#1029)
* SCIPgetNLPBranchCands * Update test_gomory.py * consistency * return type
1 parent b4a70f5 commit 258f9bf

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Added SCIP_LOCKTYPE, addVarLocksType(), getNLocksDown(), getNLocksUp(), getNLocksDownType(), getNLocksUpType(), and tests
99
- Added addMatrixConsIndicator(), and tests
1010
- Added SCIPvarMarkRelaxationOnly, SCIPvarIsRelaxationOnly, SCIPvarMarkDeletable, SCIPvarIsDeletable, and tests
11+
- Wrapped SCIPgetNLPBranchCands
1112
### Fixed
1213
- Raised an error when an expression is used when a variable is required
1314
### Changed

src/pyscipopt/scip.pxi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9106,6 +9106,18 @@ cdef class Model:
91069106
return ([Variable.create(lpcands[i]) for i in range(nlpcands)], [lpcandssol[i] for i in range(nlpcands)],
91079107
[lpcandsfrac[i] for i in range(nlpcands)], nlpcands, npriolpcands, nfracimplvars)
91089108

9109+
def getNLPBranchCands(self):
9110+
"""
9111+
Gets number of branching candidates for LP solution branching (number of fractional variables)
9112+
9113+
Returns
9114+
-------
9115+
int
9116+
number of LP branching candidates
9117+
9118+
"""
9119+
return SCIPgetNLPBranchCands(self._scip)
9120+
91099121
def getPseudoBranchCands(self):
91109122
"""
91119123
Gets branching candidates for pseudo solution branching (non-fixed variables)

tests/test_gomory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def sepaexeclp(self):
187187
if not scip.isLPSolBasic():
188188
return {"result": result}
189189

190-
#TODO: add SCIPgetNLPBranchCands
190+
assert type(scip.getNLPBranchCands()) == int
191191
# get var data ---> this is the same as getVars!
192192
vars = scip.getVars(transformed = True)
193193

0 commit comments

Comments
 (0)