Tuesday, October 6, 2009

Linear Programming with Erlang

So you have to solve a linear program, so naturally the first language you think of is Erlang. Actually, it's not a natural first choice for most people, but if you are solving a linear program as part of an automatic control strategy for an internet facing application, the choice is better motivated.

Since I faced this situation recently I wrote a binding for GLPK for Erlang. Writing port drivers is a drag so I actually wrote a program to generate the C and Erlang for me. Perhaps with the new FFI these sort of games will not be necessary, but I was happy with the approach because I anticipate experimenting with several linear programming packages, which should be much easier to accommodate.

Available at Google code.


Jean-Lou Dupont said...

I've packaged a library for interfacing between C/C++ and Erlang. Have a look at: http://epapi.googlecode.com/

Jamen Shively said...

Hello fellow Erlangers! Question: is there a linear programming solver written in Erlang? If not, what tips do you have for how I might go about writing one? Thank you in advance!

Paul Mineiro said...

@Jamen: If you are looking to have fun, I think writing a linear program solver in Erlang is great way to pass the time.

If you are looking to solve an actual problem, I don't think this is a good approach. Leaving aside Erlang specific issues (floating point performance), there are extremely good linear program solvers out there and it would be much more efficient (both programmer time and execution time) to integrate with one of them.