Skip to main content

Function: parseParameters()

parseParameters(params: Parameters, 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.
argsstring[]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 starts by params.usage followed by the list of recognized parameters which looks like this:

Help:
--help, -h Print this help
--version Print version information

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