Skip to main content

Function: parseParameters()

parseParameters(params: Parameters, usage?: string, args?: string[]): Parameters

Parses command-line solver parameters and returns a Parameters object.

Parameters

ParameterTypeDescription
paramsParametersThe default parameters. The function will overwrite the

parameters with values specified on the command line.
usage?stringA string that describes how to use the application. It is

printed when --help or -h is given.
args?string[]The command-line arguments to parse. If not specified then

process.argv.slice(2) is used.

Returns

Parameters

Remarks

For a command-line oriented application, it is useful to specify solver parameters using command-line arguments. This function parses command-line arguments and returns a Parameters object.

Parameter params is input/output. It may contain default setting that will be overwritten during parsing.

In case of an error (e.g. unrecognized parameter or an invalid parameter value) the function prints the error an calls process.exit(1).

If --help or -h is given then the function prints help and calls process.exit(0). The printed help is created by concatenating the provided usage, then follows the list of recognized parameters which looks like this:

Solver path:
--solverPath string Path to the solver

Terminal output:
--color Never|Auto|Always Whether to colorize output to the terminal

Major options:
--nbWorkers uint32 Number of threads dedicated to search
--searchType LNS|FDS|FDSLB|SetTimes
Type of search to use
--randomSeed uint32 Random seed
--logLevel uint32 Level of the log
--warningLevel uint32 Level of warnings
--logPeriod double How often to print log messages (in seconds)
--verifySolutions bool When on, correctness of solutions is verified

Limits:
--timeLimit double Wall clock limit for execution
--solutionLimit uint64 Stop the search after the given number of solutions

...

WorkerParameters can be specified for individual workers using --workerN. prefix. For example, --worker0.searchType FDS sets the search type for the first worker only.

See