rust-or / good_lp

Linear Programming for Rust, with a user-friendly API. This crate allows modeling LP problems, and lets you solve them with various solvers.
https://crates.io/crates/good_lp
MIT License
216 stars 35 forks source link

Add SCIP support #11

Closed matbesancon closed 5 months ago

matbesancon commented 2 years ago

SCIP is one of the commonly-used MI(N)LP solvers and could be of interest to the rust-or communities (free and source available for academic use).

I'd be willing to help add it to lp-solvers if this is the appropriate repository

lovasoa commented 2 years ago

Hello !

If you want to do things cleanly, you should create a raw rust binding to their C API, publish it to crates.io under scip-sys, then a safe rust binding on top of that published as scip, then add support for this rust library in good-lp

If you want to interface with the precompiled binary application (which is easier, but less versatile, less reusable and less performant), then lp-solvers is the right place. This will require less work from you, but more setup for the final user.

matbesancon commented 2 years ago

perfect thank you, I hadn't grasped the difference between the two libraries. Can we transfer this issue to good-lp to keep track of it?

lovasoa commented 2 years ago

Yes ! Are you ready to start the implementation ?

matbesancon commented 2 years ago

Yes. I was checking highs-sys. Is there a documented automated way to produce the -sys crate with bindgen?

lovasoa commented 2 years ago

Yes !https://rust-lang.github.io/rust-bindgen/

mmghannam commented 1 year ago

Hi! I am working on a rust interface for SCIP https://github.com/mmghannam/russcip. It has basic MIP-solving functionality now, it can add variables and constraints. It would be great if you could tell me the next steps to plug it into the good_lp API, more specifically which traits and functions do I need to implement. Thanks a lot!

lovasoa commented 1 year ago

Great news @mmghannam !

You should create a new file in the src/solvers directory, and add a new feature flag to this library. You can start from one of the existing solvers as an example (I think minilp is the best to take as an example because it's tiny and simple). The main thing to do is to write an scip function that takes an UnsolvedProblem and returns a custom struct that wraps an scip model object. Then you have to implement SolverModel on it.

mmghannam commented 1 year ago

Thanks! that's very helpful. I will work on it and add a pull request soon.

jacobsvante commented 5 months ago

Should this be closed?