Skip to content

Commit 6bf045e

Browse files
Fix the case of returning none from the nodeselect callback (#1102)
* Fix the case of returning none from the nodeselect callback * Update CHANGELOG --------- Co-authored-by: João Dionísio <[email protected]>
1 parent 4f896dc commit 6bf045e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Fixed
1010
- Implemented all binary operations between MatrixExpr and GenExpr
1111
- Fixed the type of @ matrix operation result from MatrixVariable to MatrixExpr.
12+
- Fixed the case for returning None from the nodeselect callback in Node Selector plugins.
1213
### Changed
1314
- Add package extras for test dependencies in `pyproject.toml`
1415
- Speed up MatrixVariable.sum(axis=None) via quicksum

src/pyscipopt/nodesel.pxi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ cdef SCIP_RETCODE PyNodeselSelect (SCIP* scip, SCIP_NODESEL* nodesel, SCIP_NODE*
8787
nodeseldata = SCIPnodeselGetData(nodesel)
8888
PyNodesel = <Nodesel>nodeseldata
8989
result_dict = PyNodesel.nodeselect()
90-
selected_node = <Node>(result_dict.get("selnode", None))
91-
selnode[0] = selected_node.scip_node
90+
selected_node = <Node>result_dict.get("selnode", None)
91+
if selected_node == None:
92+
selnode[0] = NULL
93+
else:
94+
selnode[0] = selected_node.scip_node
95+
9296
return SCIP_OKAY
9397

9498
cdef int PyNodeselComp (SCIP* scip, SCIP_NODESEL* nodesel, SCIP_NODE* node1, SCIP_NODE* node2) noexcept with gil:

0 commit comments

Comments
 (0)