Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lazy constraints at runtime #42

Open
lmores opened this issue Dec 20, 2023 · 3 comments
Open

Add lazy constraints at runtime #42

lmores opened this issue Dec 20, 2023 · 3 comments

Comments

@lmores
Copy link

lmores commented Dec 20, 2023

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!

@kkofler
Copy link
Collaborator

kkofler commented Dec 20, 2023

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:

  1. figure out the C APIs that you need (or if, as for the constraint handlers, they involve callbacks, the C++ objscip wrappers with the callback classes),
  2. add them to scipjni.i (for the callback classes, see how I did it for ObjMessagehdlr),
  3. add them to the object-oriented Java wrapper classes in the java/jscip folder, and
  4. 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 LICENSE file).

@lmores
Copy link
Author

lmores commented Dec 20, 2023

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.

@kkofler
Copy link
Collaborator

kkofler commented Dec 20, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants