LocalSolver logo
is now
Hexaly logo

We're excited to share that we are moving forward. We're leaving behind the LocalSolver brand and transitioning to our new identity: Hexaly. This represents a leap forward in our mission to enable every organization to make better decisions faster when faced with operational and strategic challenges.


Command line

An LSP program is executed with the following command in a console where file.lsp is a text file containing a valid LSP program and arguments is a list of arguments:

localsolver file.lsp [arguments]

The arguments will be available in the LSP programs as global variables. Each argument consist in an assignment of a value to a global variable. Before starting the execution of the program, these assignment statements will be executed. They are described by the following lexical definition:

arguments      : argument*
argument       : identifier "=" value
value          : float | integer | string | cmdmap
cmdmap         : ( identifier ":" cmdmapvalue | cmdmapvalue )+
cmdmapvalue    : float | integer | string

For example:

localsolver test.lsp x=12 y=abc z="a string with whitespaces" t=true

will assign the integer value 12 to variable x, the string "abc" to variable y, the string "a string with whitespaces" to variable a and the value 1 to variable t.

The assignment of values to maps follows a specific syntax:

localsolver test.lsp a=z,12,8:text,key:41

will create a map a with z associated to key 0, 12 associated to key 1, text associated to key 8 and 41 associated to key key.

Note

The syntax a={2,3} is not valid to assign maps in the command line since unix shells interpret braces as a quantifier.

Note

On Windows, the colon character : is used to separate the drive letter from the directory. Thus, do not refer explicitly to the drive when you want to pass a path in a variable.

For example localsolver myFile.lsp inFileName=C:\\tests\\test.in will not assign the given path to the global variable inFileName. According to the explained behavior above, it will create a map with \tests\test.in assigned to key C.