nzfeng / SWN

MIT License
47 stars 6 forks source link

Possibility for a version with an open source optimizer #3

Closed vijaiaeroastro closed 2 months ago

vijaiaeroastro commented 3 months ago

Thanks for open-sourcing this amazing work.

Is there a possibility of getting a version of this algorithm that uses an open-source optimizer?

nzfeng commented 3 months ago

Hi Vijai,

One solution I considered is using CoMISo, which is basically a wrapper around many different solvers (Gurobi, lpsolve, COIN-OR, etc.), and which solver is used depends on what is available on the user's local machine. However, CoMISo was difficult to get working on my own computers (Mac and Linux), requiring a bunch of machine-specific tweaking, so I was hesitant to make it part of the official SWN release.

But I like the idea of replacing the Gurobi-specific code in this project with generic code that just calls whatever solver the user prefers, open-source or otherwise. I liked Gurobi's performance, so it would be nice to keep the options open.

If you have suggestions for what C++ software to use, I'd be glad to make the changes!

Nicole

vijaiaeroastro commented 3 months ago

@nzfeng I do not know of a C++ alternative similar to CoMISo that provides a generic interface to other optimizers. Gurobi is tricky even for academics, sometimes offering licenses that only allow modeling very small problems. If you can provide a fallback with any open-source optimizer, even if there is some performance degradation, it would be useful.

nzfeng commented 3 months ago

Yeah, that's a good point.

I've just pushed a new branch called open-source-lp that uses OR-Tools, which I found reasonably straightforward to get installed. OR-Tools provides an interface to several solvers, both open-source and commercial, including the open-source CLP which has good documented performance. (OR-Tools also provides an interface to commercial solvers like CPLEX and Gurobi, if someone did still want to use those at some point.)

I've added instructions in the README on how to install OR-Tools and how to specify the back-end LP solver.

Let me know if you still have trouble!

vijaiaeroastro commented 3 months ago

@nzfeng Thank you so much. I will test this version and be happy to report any issues :)

nzfeng commented 2 months ago

Great, I'm going to close this issue for now; re-open if needed.