Closed stephenjmaher closed 3 years ago
Thank you so much! I will test and report relevant information on this new plugin
@stephenjmaher Hi Maher, after using the test_benders as a starting example along with the benders plugin (not the benders cuts) I found the benderssolvesubconvex is not invoked as expected. while callback functions benderscreatesub and bendersgetvar work well without reporting an error. Can you have a look at what's the possible reason? And there seem no available functions for setting up and solving subproblem given the primal solution of the master problem in benderssolvesubconvex except the computeBestSolSubproblems. So I write one with a few modifications. Do you have some ideas in writing the appropriate benderssolvesubconvex? The code and a new added function are included in the zipped file. BendersTest.zip
The test file was very helpful. The thing you are missing is activating the Benders' decomposition constraint handler(s). This is done by calling
model.setBoolParam("constraints/benders/active", True)
if you want to use the two-phase method, then you also need to call
model.setBoolParam("constraints/benderslp/active", True)
Setting these parameters will invoke the benderssolvesubconvex
correctly.
I have now added the wrapper functions for SCIPsetupBendersSubproblem
and SCIPsolveBendersSubproblem
in the pull request #273.
When you are writing a custom benderssolvesub
and benderssolvesubconvex
, then it is only possible to use setupBendersSubproblem
if the subproblem is a SCIP instance.
Also, when you specify a custom benderssolvesub
or benderssolvesubconvex
, you will need to perform the subproblem setup yourself (this could involve calling setupBendersSubproblem
).
Thank you!
@stephenjmaher After implementing the benderssolvesubconvex follow your suggestions. I got Exceptions when call the function setupBendersSubproblem and solveBendersSubproblem. The error logs are as follow:
File "src/pyscipopt/scip.pyx", line 2645, in pyscipopt.scip.Model.setupBendersSubproblem
File "src/pyscipopt/scip.pyx", line 226, in pyscipopt.scip.PY_SCIP_CALL
Exception: SCIP: method cannot be called at this time in solution process!
Exception ignored in: 'pyscipopt.scip.PyBendersSolvesubconvex'
File "src/pyscipopt/scip.pyx", line 2675, in pyscipopt.scip.Model.solveBendersSubproblem
File "src/pyscipopt/scip.pyx", line 210, in pyscipopt.scip.PY_SCIP_CALL
Exception: SCIP: unspecified error!
Exception ignored in: 'pyscipopt.scip.PyBendersSolvesubconvex'
There are also some typos in the updated scip.pyx, I have uploaded the test benders example and my corrected scip.pyx file in the zipped package. testBenders2.zip
@andynuaa, why don't you just fork the repo and commit your changes via a pull request? This is way more convenient than attaching archives of your code suggestions.
Prior to the pull request https://github.com/SCIP-Interfaces/PySCIPOpt/pull/262, there was no ability in PySCIPOpt to implement a custom Benders' decomposition cutting method. At the requestion @andynuaa, this functionality has been provided.
Currently, there are no test cases for this plugin in PySCIPOpt. So this issue has been opened to discuss and problems that arise from the implementation of custom Benders' decomposition cuts.