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

Does good_lp work on Windows with CBC? [It does] #25

Closed Thell closed 1 year ago

Thell commented 1 year ago

As the title states...

I didn't spot anything in the README or docs so I tried with the latest https://github.com/coin-or/Cbc/releases/tag/releases%2F2.10.8 msvc17 build and ensured the bin, lib and include are in the PATH but no love. I guessed it was because it is called libCBCSolver.lib and not CBCSolver.lib. So, I renamed it and still no love. So I moved it into my project root and at least it found it but then could resolve any of the exports. I also tried using the CBCSolver.lib from the OR-Tools distribution and the same thing.

lovasoa commented 1 year ago

That should probably be reported to https://github.com/KardinalAI/coin_cbc instead of here

Thell commented 1 year ago

Thanks, will do. Although, if you do happen to have heard of it working or if you haven't heard of it working, that'd be nice to know too.

Thell commented 1 year ago

Hi again! I just wanted to report back that, yes, it can work on windows. A few additions had to be added to the coin_cbc_sys to get the path for the cbc libs and setting the link kind to static but after that it works. Hopefully the pull request for that change will get merged and then good_lp should work on windows with minimal fuss. 👍

matsujp commented 11 months ago

I'm also facing the same issue of not being able to use good_lp on Windows. Could you please share the steps you took to make it work? I would greatly appreciate it!

Thell commented 11 months ago

Unfortunately I can't. When I removed my clone from my account the PR also got removed which had the setup I was able to get working. That was as far as I went on the road to using COIN and good_lp. I ended up using HiGHS for my end solution.

matsujp commented 11 months ago

Thank you for your response! I was able to use good_lp (CBC) on Windows. By renaming the "libCbcSolver.lib" file in the lib folder of coinor-cbc for Windows to "CbcSolver.lib" and adding the following code to build.rs in coin_cbc_sys, I was able to make it work.

fn main() {
    let _ = pkg_config::probe_library("cbc");
    println!(r"cargo:rustc-link-search= *path_to_CbcSolver.lib* ");
    println!(r"cargo:rustc-link-lib=static=CbcSolver");
    println!(r"cargo:rustc-link-lib=static=libCbc");
    println!(r"cargo:rustc-link-lib=static=libCgl");
    println!(r"cargo:rustc-link-lib=static=libCoinUtils");
    println!(r"cargo:rustc-link-lib=static=libClp");
    println!(r"cargo:rustc-link-lib=static=libOsi");
    println!(r"cargo:rustc-link-lib=static=libOsiClp");
}
lovasoa commented 11 months ago

Good. You should make a PR in coin_cbc_sys!