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 support for SCIP cardinality constraints #39

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

yonch
Copy link
Contributor

@yonch yonch commented Sep 3, 2023

This adds the ability of users to add cardinality constraints when using a SCIP optimizer.

This will also require a Cargo.toml change to a dependency version of russcip with the cardinality support, which is tracked by scipopt/russcip#106 -- so this is not yet ready to merge.

(cardinality constraints allow a user to limit the number of non-zero variables from a given set in the solution to be <= N.)

@lovasoa
Copy link
Collaborator

lovasoa commented Sep 3, 2023

Hello and thanks for the PR! We do already give miracle access to the scip model object, so we shouldn't have anything to do here to support new scip features. But what would be interesting in good_lp would be to implement this as a trait, with implementations on multiple optimizers.

yonch added a commit to yonch/good_lp that referenced this pull request Oct 5, 2023
this addressess @lovasoa 's comment rust-or#39 (comment)

also upgrades russcip dependency to one that supports cardinality constraints.
this makes this version compatible with the code in russcip 0.2.6
this addressess @lovasoa 's comment rust-or#39 (comment)

also upgrades russcip dependency to one that supports cardinality constraints.
@yonch
Copy link
Contributor Author

yonch commented Oct 5, 2023

Hi @lovasoa , thanks for the comment. The trait idea seems a good trade-off, and I pushed an update to the PR. If accepted I think this helps users create constraints using good_lp Variables without understanding the underlying interface of solvers with good_lp.

Also rebased to current main.

On the other hand, if this is not aligned with good_lp architecture feel free to close this PR.

Copy link
Collaborator

@lovasoa lovasoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! This looks good to me

@lovasoa
Copy link
Collaborator

lovasoa commented Oct 5, 2023

You can fix the tests (looks like you forgot to run cargo fmt) and I'll merge.

@yonch
Copy link
Contributor Author

yonch commented Oct 5, 2023

oops, sorry for that (cargo fmt). thanks for catching & fixing!

@lovasoa lovasoa merged commit 2f2b691 into rust-or:main Oct 6, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants