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

Is it possible to include SCIP disjunctive constraints? Thanks #161

Open
brucelit opened this issue Oct 23, 2024 · 7 comments
Open

Is it possible to include SCIP disjunctive constraints? Thanks #161

brucelit opened this issue Oct 23, 2024 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@brucelit
Copy link

Hi Mr. Ghannam,

Thank you for this wonderful crate. I wonder whether you plan to support the disjunctive constraints of SCIP (https://scipopt.org/doc/html/cons__disjunction_8h.php) soon?

My LP problem requires satisfying at least one of the constraints, and I hope to implement a solution in Rust. For now, SCIP seems to be the only available choice.

A disjunction constraint 𝐶 is a constraint of the form

𝐶=𝐶1∨⋯∨𝐶𝑛

where all the 𝐶𝑖 are individual constraints themselves.

Best regards,

Bruce

@mmghannam
Copy link
Member

Hi Bruce,
Happy to hear you found the crate useful! I'm not sure I would be able to work on this soon. But if you need it, it should not be too much work to include it, you can already call the direct C bindings using the ffi module and the raw feature. If you decide to contribute an add_cons_disjunction method you should take a look at the other add_cons_* methods for inspiration :)

@mmghannam mmghannam added enhancement New feature or request help wanted Extra attention is needed labels Oct 24, 2024
@brucelit
Copy link
Author

Hi Mr. Ghannam,

thank you for your reply and hints. I will try to solve it myself and hopefully contribute to this repo.

@mmghannam
Copy link
Member

Hi again :) First of all, please not so formal. Just Mo works 😄

Thinking about this again I realized it's not as simple as I first thought. One would need first to create methods that create a constraint but not add it to the model. Then use these constraints to add them to a disjunction constraint.

@brucelit
Copy link
Author

brucelit commented Oct 28, 2024

Hi Mo,

you are right. Actually, I found a way to bypass using disjunctive constraints by introducing additional decision variables and then using Big-M method.

Best regards,

Bruce

@mmghannam
Copy link
Member

You could also achieve the same I think with binary variables and indicator constraints (to skip figuring out what the right M is 😄). Take a look at add_cons_indicator

@matbesancon
Copy link
Member

Hi @brucelit, as an alternative approach if finding a tight big-M value is hard for your problem, indicators have received more attention and smart tricks than disjunctions, even though they are more or less equivalent:
https://scipopt.org/doc/html/cons__indicator_8h.php
You just need an additional binary variable mentioning whether a constraint should be active

@brucelit
Copy link
Author

Dear Mo and Mathieu,

thank you very much for the indicator idea. I am not an expert in linear programming, so your suggestion on this helped me greatly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants