This library is a modeling tool for Linear Programming (LP) and Mixed Integer Programming (MIP). The model can be exported to CPLEX LP file format, which can be loaded by various solvers. Importing models from LP file is also supported.
# optional but recommended to pin dev-repo as it's on quite early stage of development
opam pin lp --dev-repo
opam install lplet problem =
let open Lp in
let x = var "x" in
let y = var "y" in
let c0 = x + c 1.2 * y <$ c 5.0 in
let c1 = c 2.0 * x + y <$ c 1.2 in
let obj = maximize (x + y) in
let cnstrs = [c0; c1] in
(obj, cnstrs)
let () =
if Lp.validate problem then
Lp.write "my_problem.lp" problem
else
print_endline "Oops, my problem is broken."Currently only basic features of LP file format are supported. (There is no standard of LP file, though.)
Some references to LP file format.
MIT