Add lazy constraints at runtime
Hi everyone, I would like to try out and experiment with SCIP using the Java API. However, it is unclear to me whether the Java API allows to add user defined cuts and/or lazy constraints while SCIP is solving a model.
E.g.: could I solve a simple Travelling Salesmann Problem starting from an incomplete model with just "flow constraints" and add Subtour Elimination Constraints and/or Connectivity Constraints manually at runtime?
Thank you a lot!
At this time, no. But it can be added, though I do not have the time to do so myself at the moment.
How you would go at it is:
- figure out the C APIs that you need (or if, as for the constraint handlers, they involve callbacks, the C++
objscipwrappers with the callback classes), - add them to
scipjni.i(for the callback classes, see how I did it forObjMessagehdlr), - add them to the object-oriented Java wrapper classes in the
java/jscipfolder, and - when done, submit a pull request to this repository (thereby acknowledging and authorizing that the code will be released under the MIT License as shipped in the
LICENSEfile).
Thanks a lot for the hints. Being the very first time time I am using SCIP I hoped I could use Java to avoid the complexity of C and C++ that requires manual memory management and longer implementation times. If I find some spare time I will try my best and (if I succeed) I will open a PR.
The good thing about JSCIP is that the hard part of doing the C/C++ to Java binding is done by the SWIG binding generator.