LocalSolver Modeler

Usable by both developers and mathematicians, LSP fills the gap between modeling and programming languages. LSP is natively integrated with LocalSolver, at no extra cost.

LSP perfectly mixes programming and modeling features

Why code with LSP?

All existing modeling languages have the same flaw: they become useless when you need to manipulate or edit data or results. They force you to use external scripts or languages.

On the contrary, LSP is a dynamically typed, imperative language with unique structured programming features that facilitate modeling for all kinds of optimization problems: linear and highly non-linear problems, combinatorial problems, set based problems…

Editor • toy.lsp
function model() {
    x[0..7] <- bool();
    weights <- { 10, 60, 30, 40, 30, 20, 20, 2 };
    prices <- { 1, 10, 15, 40, 60, 90, 100, 15 };
    constraint sum[i in 0..7](x[i]*weights[i]) <= 102;
    maximize sum[i in 0..7](x[i]*prices[i]);

function param() {
    lsTimeLimit = 10;
localsolver toy.lsp
Load toy.lsp...
Run input...
Run model...
Run param...
Run solver...

Model:  expressions = 62, decisions = 8, constraints = 1, objectives = 1
Param:  time limit = 10 sec, no iteration limit

[objective direction ]:     maximize

[  0 sec,       0 itr]:            0
[ optimality gap     ]:      100.00%
[  0 sec,   16402 itr]:          280
[ optimality gap     ]:           0%

16402 iterations performed in 0 seconds

Optimal solution:
  obj    =          280
  gap    =           0%
  bounds =          280

Run output...

Concise & close to mathematical formalism

With LSP, the use of paper or LaTeX formulas to model your problems is over. Coupled with the richness and expressiveness of LocalSolver, our modeling language is understandable even to people who do not know the LSP syntax.


LSP takes full advantage of its powerful integration with LocalSolver. By writing your models in LSP, you get the best possible modeling times and performance compared to other dynamic languages like Python.

Builtin I/O features

You do not have to worry about decoding your data anymore. LSP does it for you in a few lines. It has all the features you need to easily read various file formats (like JSON or CSV) or manipulate dates and times. It also has built-in support for many charsets and encodings.

Easy integration

LSP works as a standalone program, but it also has its API that you can call from your favorite languages like Python, C#, C++, or Java. You can run your LSP programs from your applications and easily exchange data. If you miss a feature, code it in your language and expose it directly in LSP.

Ready to start?

The LSP language and the LocalSolver Modeler are included with LocalSolver Optimizer at no extra cost.