forked from ds4dm/PySCIPOpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scipopt#262 from SCIP-Interfaces/sm/benderscut-plu…
…gins Adds the class for Benders' decomposition cutting methods
- Loading branch information
Showing
4 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
cdef class Benderscut: | ||
cdef public Model model | ||
cdef public Benders benders | ||
cdef public str name | ||
|
||
def benderscutfree(self): | ||
pass | ||
|
||
def benderscutinit(self): | ||
pass | ||
|
||
def benderscutexit(self): | ||
pass | ||
|
||
def benderscutinitsol(self): | ||
pass | ||
|
||
def benderscutexitsol(self): | ||
pass | ||
|
||
def benderscutexec(self, solution, probnumber, enfotype): | ||
print("python error in benderscutexec: this method needs to be implemented") | ||
return {} | ||
|
||
cdef SCIP_RETCODE PyBenderscutCopy (SCIP* scip, SCIP_BENDERS* benders, SCIP_BENDERSCUT* benderscut): | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyBenderscutFree (SCIP* scip, SCIP_BENDERSCUT* benderscut): | ||
cdef SCIP_BENDERSCUTDATA* benderscutdata | ||
benderscutdata = SCIPbenderscutGetData(benderscut) | ||
PyBenderscut = <Benderscut>benderscutdata | ||
PyBenderscut.benderscutfree() | ||
Py_DECREF(PyBenderscut) | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyBenderscutInit (SCIP* scip, SCIP_BENDERSCUT* benderscut): | ||
cdef SCIP_BENDERSCUTDATA* benderscutdata | ||
benderscutdata = SCIPbenderscutGetData(benderscut) | ||
PyBenderscut = <Benderscut>benderscutdata | ||
PyBenderscut.benderscutinit() | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyBenderscutExit (SCIP* scip, SCIP_BENDERSCUT* benderscut): | ||
cdef SCIP_BENDERSCUTDATA* benderscutdata | ||
benderscutdata = SCIPbenderscutGetData(benderscut) | ||
PyBenderscut = <Benderscut>benderscutdata | ||
PyBenderscut.benderscutexit() | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyBenderscutInitsol (SCIP* scip, SCIP_BENDERSCUT* benderscut): | ||
cdef SCIP_BENDERSCUTDATA* benderscutdata | ||
benderscutdata = SCIPbenderscutGetData(benderscut) | ||
PyBenderscut = <Benderscut>benderscutdata | ||
PyBenderscut.benderscutinitsol() | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyBenderscutExitsol (SCIP* scip, SCIP_BENDERSCUT* benderscut): | ||
cdef SCIP_BENDERSCUTDATA* benderscutdata | ||
benderscutdata = SCIPbenderscutGetData(benderscut) | ||
PyBenderscut = <Benderscut>benderscutdata | ||
PyBenderscut.benderscutexitsol() | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyBenderscutExec (SCIP* scip, SCIP_BENDERS* benders, SCIP_BENDERSCUT* benderscut, SCIP_SOL* sol, int probnumber, SCIP_BENDERSENFOTYPE type, SCIP_RESULT* result): | ||
cdef SCIP_BENDERSCUTDATA* benderscutdata | ||
benderscutdata = SCIPbenderscutGetData(benderscut) | ||
PyBenderscut = <Benderscut>benderscutdata | ||
if sol == NULL: | ||
solution = None | ||
else: | ||
solution = Solution.create(sol) | ||
enfotype = type | ||
result_dict = PyBenderscut.benderscutexec(solution, probnumber, enfotype) | ||
result[0] = result_dict.get("result", <SCIP_RESULT>result[0]) | ||
return SCIP_OKAY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters