lua-users home
lua-l archive

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

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.


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:

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