lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Geoff Leyland wrote:
Hi List,

I've written a binding to three free LP and MILP [1] solvers: CLP [2], CBC [3] and lpsolve [4]. It includes just enough symbolic processing to work out if if an expression is linear, and a first draft of a method for composing models.
Documentation is included.

Examples:

x, y = rima.R"x, y"
e = x * y
print(rima.E(e * x * y))                                 --> x^2*y^2

x, y = rima.R"x, y"
print(rima.E(x, { x=y^2, y=5 }))                 --> 25


Simple LP:

local x, y = rima.R"x, y"
local f = rima.formulation:new()
f:add(x + 2*y, "<=", 3)
f:add(2*x + y, "<=", 3)
f:set_objective(x + y, "maximise")
f:set{ ["x, y"] = rima.positive() }
local r = f:solve("clp")
print(r.variables.x.p, r.variables.y.p)        --> 1 1


Following tradition it's available under the MIT license. It's available at:

http://www.incremental.co.nz/download/rima-0.01.tar.gz

Thanks to everyone who helped me come up with a name and Steve Donovan, from whom I've stolen a few good ideas.

Cheers,
Geoff


[1] http://en.wikipedia.org/wiki/Linear_programming
[2] https://projects.coin-or.org/Clp
[3] https://projects.coin-or.org/Cbc
[4] http://sourceforge.net/projects/lpsolve


Neat! I'll certainly take a look. As for stealing good ideas, there's only so much innovation in anything, the best you can do is improve what others have done before you.