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
238 stars 34 forks source link

add the option to disable singlethreaded-cbc #22

Closed tiborschneider closed 1 year ago

tiborschneider commented 1 year ago

The dependency coin_cbc uses a default feature, singlethread-cbc, to introduce a global lock around the solve function of Cbc. They give the following reason:

This is because by default, libcbc is not thread safe. If you have compiled your own libcbc with the CBC_THREAD_SAFE option, you can disable this behavior by disabling the singlethread-cbc feature on this crate.

Unfortunately, if one includes your library and enables the coin_cbc feature, the dependency is added with all default features, and there is no way (to the best of my knowledge) to disable such a feature again.

This pull request also adds a default feature, singlethread-cbc, to this library which enables coin_cbc/singlethread-cbc if it is also included. This way, users of your library can opt out of singlethread-cbc if they can guarantee that they compiled the project with the appropriate falgs.

tiborschneider commented 1 year ago

I cannot explain why the build fails. It cannot link to some Highs functions, which I have not touched. I reverted the commit and triggered the action again, and it still fails.

lovasoa commented 1 year ago

I think it's because the CI uses --all-features