Quick tour of LocalSolver’s modeler¶
The best way to discover LocalSolver is to use the built-in modeling language. It provides many mathematical operators and facilitates goal programming. The language itself, called LSP (for LocalSolver Programming language) can be both used for programming and modeling: in the same LSP program it is possible to manipulate data structures as in an imperative language and define the optimization model.
As a result, models written in LSP language are really concise and readable.
They are structured around 5 predefined functions: input()
, model()
,
param()
, display()
, output()
. These functions, called in this order,
induce the flow of the program launched by the LocalSolver executable:
input
: for declaring your data or reading them from files.model
: for declaring your optimization model.param
: for parameterizing the local-search solver before running.display
: for displaying some info in console or in some files during the resolution.output
: for writing results in console or in some files, once the resolution is finished.
The quick tour of LocalSolver’s modeler covers the following main topics: the basics of mathematical modeling, the programming style, and the list of all built-in variables and functions. For more details on the modeling language, see LSP Reference Manual.
We start this tour by solving a celebrated problem of the operations research literature: the knapsack problem.