@@ -2057,6 +2057,15 @@ cdef class Model:
2057
2057
def freeTransform (self ):
2058
2058
""" Frees all solution process data including presolving and
2059
2059
transformed problem, only original problem is kept."""
2060
+ if self .getStage() not in [SCIP_STAGE_INIT,
2061
+ SCIP_STAGE_PROBLEM,
2062
+ SCIP_STAGE_TRANSFORMED,
2063
+ SCIP_STAGE_PRESOLVING,
2064
+ SCIP_STAGE_PRESOLVED,
2065
+ SCIP_STAGE_SOLVING,
2066
+ SCIP_STAGE_SOLVED]:
2067
+ raise Warning (" method cannot be called in stage %i ." % self .getStage())
2068
+
2060
2069
self ._modelvars = {
2061
2070
var: value
2062
2071
for var, value in self ._modelvars.items()
@@ -6175,6 +6184,11 @@ cdef class Model:
6175
6184
6176
6185
def presolve (self ):
6177
6186
""" Presolve the problem."""
6187
+ if self .getStage() not in [SCIP_STAGE_PROBLEM, SCIP_STAGE_TRANSFORMED,\
6188
+ SCIP_STAGE_PRESOLVING, SCIP_STAGE_PRESOLVED, \
6189
+ SCIP_STAGE_SOLVED]:
6190
+ raise Warning (" method cannot be called in stage %i ." % self .getStage())
6191
+
6178
6192
PY_SCIP_CALL(SCIPpresolve(self ._scip))
6179
6193
self ._bestSol = Solution.create(self ._scip, SCIPgetBestSol(self ._scip))
6180
6194
@@ -8977,6 +8991,15 @@ cdef class Model:
8977
8991
8978
8992
def freeReoptSolve (self ):
8979
8993
""" Frees all solution process data and prepares for reoptimization."""
8994
+
8995
+ if self .getStage() not in [SCIP_STAGE_INIT,
8996
+ SCIP_STAGE_PROBLEM,
8997
+ SCIP_STAGE_TRANSFORMED,
8998
+ SCIP_STAGE_PRESOLVING,
8999
+ SCIP_STAGE_PRESOLVED,
9000
+ SCIP_STAGE_SOLVING,
9001
+ SCIP_STAGE_SOLVED]:
9002
+ raise Warning (" method cannot be called in stage %i ." % self .getStage())
8980
9003
PY_SCIP_CALL(SCIPfreeReoptSolve(self ._scip))
8981
9004
8982
9005
def chgReoptObjective (self , coeffs , sense = ' minimize' ):
0 commit comments