Skip to content

Commit

Permalink
Merge pull request scipopt#380 from lascavana/master
Browse files Browse the repository at this point in the history
add leaf counters
  • Loading branch information
fserra authored May 28, 2020
2 parents efa685e + 5cf7251 commit b0d4c53
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pyscipopt/scip.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,8 @@ cdef extern from "scip/scip.h":
# Statistic Methods
SCIP_RETCODE SCIPprintStatistics(SCIP* scip, FILE* outfile)
SCIP_Longint SCIPgetNNodes(SCIP* scip)
SCIP_Longint SCIPgetNFeasibleLeaves(SCIP* scip)
SCIP_Longint SCIPgetNInfeasibleLeaves(SCIP* scip)
SCIP_Longint SCIPgetNLPs(SCIP* scip)
SCIP_Longint SCIPgetNLPIterations(SCIP* scip)

Expand Down Expand Up @@ -1651,6 +1653,9 @@ cdef extern from "scip/pub_lp.h":

cdef extern from "scip/scip_tree.h":
SCIP_RETCODE SCIPgetOpenNodesData(SCIP* scip, SCIP_NODE*** leaves, SCIP_NODE*** children, SCIP_NODE*** siblings, int* nleaves, int* nchildren, int* nsiblings)
SCIP_Longint SCIPgetNLeaves(SCIP* scip)
SCIP_Longint SCIPgetNChildren(SCIP* scip)
SCIP_Longint SCIPgetNSiblings(SCIP* scip)

cdef extern from "scip/scip_var.h":
SCIP_RETCODE SCIPchgVarBranchPriority(SCIP* scip, SCIP_VAR* var, int branchpriority)
Expand Down
20 changes: 20 additions & 0 deletions src/pyscipopt/scip.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,26 @@ cdef class Model:
"""Retrieve the total number of processed nodes."""
return SCIPgetNNodes(self._scip)

def getNFeasibleLeaves(self):
"""Retrieve number of leaf nodes processed with feasible relaxation solution."""
return SCIPgetNFeasibleLeaves(self._scip)

def getNInfeasibleLeaves(self):
"""gets number of infeasible leaf nodes processed."""
return SCIPgetNInfeasibleLeaves(self._scip)

def getNLeaves(self):
"""gets number of leaves in the tree."""
return SCIPgetNLeaves(self._scip)

def getNChildren(self):
"""gets number of children of focus node."""
return SCIPgetNChildren(self._scip)

def getNSiblings(self):
"""gets number of siblings of focus node."""
return SCIPgetNSiblings(self._scip)

def getCurrentNode(self):
"""Retrieve current node."""
return Node.create(SCIPgetCurrentNode(self._scip))
Expand Down

0 comments on commit b0d4c53

Please sign in to comment.