Skip to content

Commit f14c3a2

Browse files
raise error (#1123)
1 parent 5901e6d commit f14c3a2

7 files changed

Lines changed: 13 additions & 26 deletions

File tree

src/pyscipopt/benders.pxi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ cdef class Benders:
3535

3636
def benderscreatesub(self, probnumber):
3737
'''creates the subproblems and registers it with the Benders decomposition struct '''
38-
print("python error in benderscreatesub: this method needs to be implemented")
39-
return {}
38+
raise NotImplementedError("benderscreatesub() is a fundamental callback and should be implemented in the derived class")
4039

4140
def benderspresubsolve(self, solution, enfotype, checkint):
4241
'''sets the pre subproblem solve callback of Benders decomposition '''
@@ -60,8 +59,7 @@ cdef class Benders:
6059

6160
def bendersgetvar(self, variable, probnumber):
6261
'''Returns the corresponding master or subproblem variable for the given variable. This provides a call back for the variable mapping between the master and subproblems. '''
63-
print("python error in bendersgetvar: this method needs to be implemented")
64-
return {}
62+
raise NotImplementedError("bendersgetvar() is a fundamental callback and should be implemented in the derived class")
6563

6664
# local helper functions for the interface
6765
cdef Variable getPyVar(SCIP_VAR* var):

src/pyscipopt/benderscut.pxi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ cdef class Benderscut:
2121
pass
2222

2323
def benderscutexec(self, solution, probnumber, enfotype):
24-
print("python error in benderscutexec: this method needs to be implemented")
25-
return {}
24+
raise NotImplementedError("benderscutexec() is a fundamental callback and should be implemented in the derived class")
2625

2726
cdef SCIP_RETCODE PyBenderscutCopy (SCIP* scip, SCIP_BENDERS* benders, SCIP_BENDERSCUT* benderscut) noexcept with gil:
2827
return SCIP_OKAY

src/pyscipopt/conshdlr.pxi

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,19 @@ cdef class Conshdlr:
5555

5656
def consenfolp(self, constraints, nusefulconss, solinfeasible):
5757
'''calls enforcing method of constraint handler for LP solution for all constraints added'''
58-
print("python error in consenfolp: this method needs to be implemented")
59-
return {}
58+
raise NotImplementedError("consenfolp() is a fundamental callback and should be implemented in the derived class")
6059

6160
def consenforelax(self, solution, constraints, nusefulconss, solinfeasible):
6261
'''calls enforcing method of constraint handler for a relaxation solution for all constraints added'''
63-
print("python error in consenforelax: this method needs to be implemented")
64-
return {}
62+
raise NotImplementedError("consenforelax() is a fundamental callback and should be implemented in the derived class")
6563

6664
def consenfops(self, constraints, nusefulconss, solinfeasible, objinfeasible):
6765
'''calls enforcing method of constraint handler for pseudo solution for all constraints added'''
68-
print("python error in consenfops: this method needs to be implemented")
69-
return {}
66+
raise NotImplementedError("consenfops() is a fundamental callback and should be implemented in the derived class")
7067

7168
def conscheck(self, constraints, solution, checkintegrality, checklprows, printreason, completely):
7269
'''calls feasibility check method of constraint handler '''
73-
print("python error in conscheck: this method needs to be implemented")
74-
return {}
70+
raise NotImplementedError("conscheck() is a fundamental callback and should be implemented in the derived class")
7571

7672
def consprop(self, constraints, nusefulconss, nmarkedconss, proptiming):
7773
'''calls propagation method of constraint handler '''
@@ -89,8 +85,7 @@ cdef class Conshdlr:
8985

9086
def conslock(self, constraint, locktype, nlockspos, nlocksneg):
9187
'''variable rounding lock method of constraint handler'''
92-
print("python error in conslock: this method needs to be implemented")
93-
return {}
88+
raise NotImplementedError("conslock() is a fundamental callback and should be implemented in the derived class")
9489

9590
def consactive(self, constraint):
9691
'''sets activation notification method of constraint handler '''

src/pyscipopt/event.pxi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ cdef class Eventhdlr:
3434

3535
def eventexec(self, event):
3636
'''calls execution method of event handler '''
37-
print("python error in eventexec: this method needs to be implemented")
38-
return {}
37+
raise NotImplementedError("eventexec() is a fundamental callback and should be implemented in the derived class")
3938

4039

4140
# local helper functions for the interface

src/pyscipopt/heuristic.pxi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ cdef class Heur:
2626

2727
def heurexec(self, heurtiming, nodeinfeasible):
2828
'''should the heuristic the executed at the given depth, frequency, timing,...'''
29-
print("python error in heurexec: this method needs to be implemented")
30-
return {}
29+
raise NotImplementedError("heurexec() is a fundamental callback and should be implemented in the derived class")
3130

3231

3332

src/pyscipopt/presol.pxi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ cdef class Presol:
2525

2626
def presolexec(self, nrounds, presoltiming):
2727
'''executes presolver'''
28-
print("python error in presolexec: this method needs to be implemented")
29-
return {}
28+
raise NotImplementedError("presolexec() is a fundamental callback and should be implemented in the derived class")
3029

3130

3231

src/pyscipopt/propagator.pxi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ cdef class Prop:
3737

3838
def propexec(self, proptiming):
3939
'''calls execution method of propagator'''
40-
print("python error in propexec: this method needs to be implemented")
41-
return {}
40+
raise NotImplementedError("propexec() is a fundamental callback and should be implemented in the derived class")
4241

4342
def propresprop(self, confvar, inferinfo, bdtype, relaxedbd):
4443
'''resolves the given conflicting bound, that was reduced by the given propagator'''
45-
print("python error in propresprop: this method needs to be implemented")
46-
return {}
44+
raise NotImplementedError("propresprop() is a fundamental callback and should be implemented in the derived class")
4745

4846

4947

0 commit comments

Comments
 (0)