Skip to content

Commit 6ee2c67

Browse files
committed
add support for [get|set]HeurTiming
1 parent 6f51e81 commit 6ee2c67

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/pyscipopt/scip.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,8 @@ cdef extern from "scip/scip.h":
11191119
SCIP_HEURDATA* heurdata)
11201120
SCIP_HEURDATA* SCIPheurGetData(SCIP_HEUR* heur)
11211121
SCIP_HEUR* SCIPfindHeur(SCIP* scip, const char* name)
1122+
SCIP_HEURTIMING SCIPheurGetTimingmask(SCIP_HEUR* heur)
1123+
void SCIPheurSetTimingmask(SCIP_HEUR* heur, SCIP_HEURTIMING timingmask)
11221124

11231125
#Relaxation plugin
11241126
SCIP_RETCODE SCIPincludeRelax(SCIP* scip,

src/pyscipopt/scip.pxi

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,6 +2887,41 @@ cdef class Model:
28872887
"""
28882888
PY_SCIP_CALL(SCIPsetHeuristics(self._scip, setting, True))
28892889

2890+
def setHeurTiming(self, heurname, heurtiming):
2891+
"""
2892+
Set the timing of a heuristic
2893+
2894+
Parameters
2895+
----------
2896+
heurname : string, name of the heuristic
2897+
heurtiming : PY_SCIP_HEURTIMING
2898+
"""
2899+
cdef SCIP_HEUR* _heur
2900+
n = str_conversion(heurname)
2901+
_heur = SCIPfindHeur(self._scip, n)
2902+
if _heur == NULL:
2903+
raise ValueError("Could not find heuristic <%s>" % heurname)
2904+
SCIPheurSetTimingmask(_heur, heurtiming)
2905+
2906+
def getHeurTiming(self, heurname):
2907+
"""
2908+
Get the timing of a heuristic
2909+
2910+
Parameters
2911+
----------
2912+
heurname : string, name of the heuristic
2913+
2914+
Returns
2915+
-------
2916+
SCIP_HEURTIMING
2917+
"""
2918+
cdef SCIP_HEUR* _heur
2919+
n = str_conversion(heurname)
2920+
_heur = SCIPfindHeur(self._scip, n)
2921+
if _heur == NULL:
2922+
raise ValueError("Could not find heuristic <%s>" % heurname)
2923+
return SCIPheurGetTimingmask(_heur)
2924+
28902925
def disablePropagation(self, onlyroot=False):
28912926
"""
28922927
Disables propagation in SCIP to avoid modifying the original problem during transformation.

0 commit comments

Comments
 (0)