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 const to determine at compile-time what default_solver resolves to #32

Closed NickHu closed 9 months ago

NickHu commented 11 months ago

Motivation: my application uses good_lp, and mirrors the structure you have here of using features to enable/disable various solver backends. I would like to be able to print out which solver is being used.

There's some reasonably complex logic in https://github.com/rust-or/good_lp/blob/f7483e2743bf97a76f65460835ce7fe89c746a9a/src/lib.rs#L73-L110 to determine which solver is the default which I'd rather not copy. I think the cleanest solution would be to add something like pub const SOLVER_NAME: &str = "cbc" in src/solvers/coin_cbc.rs etc. and reexport it.

lovasoa commented 11 months ago

That would be a nice and useful feature indeed ! Do you want to open a small PR ? I can help if you have any question !