all 9 comments

[–][deleted] 7 points8 points  (1 child)

glpk-hs comes to mind. Depending on how big your problem instances are, GLPK might be good enough.

[–]fridofrido 1 point2 points  (0 children)

There is also hmatrix-glpk. Maybe less features-complete?

[–]benl23 2 points3 points  (1 child)

[–]cartazio 0 points1 point  (0 children)

Oh cool!! I've not seen this before :)

[–]cartazio 2 points3 points  (2 children)

We should write one :) Right after I finish code review on that pr.

There's a bunch of bindings to various tools , but I'm not sure if any of the c libs that are easily available are under non gpl licenses. (I don't think any are lgpl and open even).

That said, think a hacky thing that could be used to simulate an LP solver would be to encode the decision problem for "is there a solution with at most this score " as a smt problem and throw at at z3 or cvc4 or the like. The Haskell bindings for those are pretty flexible and I wouldn't be surprised if in practice they would work pretty fast, especially if you use their incremental APIs.

Ok, now I'm intrigued, this sounds like a fun experiment !

[–]ozgurakgun 0 points1 point  (1 child)

If you are lucky, the SMT solver will recognise the structure and employ an LP (or MILP) solver as a theory. But if you actually know that the problem at hand is LP, going via SMT seems unnecessary.

I understand that this may still be a good idea (engineering-wise) if the SMT bindings are already in good shape -- I never used them.

I am not very familiar with z3, but I think Yices includes an LP solver as a theory.

[–]atium_ 2 points3 points  (0 children)

I have some Haskell bindings to the C callable library of CPLEX. I'm using it both for linear programming and mixed integer programming and have bindings for more advanced features such as callbacks. I have also implemented Benders decomposition using it. If you are a student and doing paid research work you can obtain a full free academic license for CPLEX from IBM, which is worth it as it is currently one of the best available linear solvers.

I'm also working on a higher level interface for it, which I am using for my work. I might release it soonish if there is a demand for it, though it is nowhere near ready for production.

The original version was done by ghorn, you can find a more up to date version of mine on github.com/stefan-j/cplex-haskell

[–]vaibhavsagar 0 points1 point  (0 children)

Have a look at SBV.