[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Lua and Linear Programming**
**From**: Geoff Leyland <geoff_leyland@...>
**Date**: Wed, 20 May 2009 22:31:39 +1200

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