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 helpful 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 a 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, the 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 worker(s) using the following prefixes:

  • --workerN. or --workersN. for worker N
  • --workerN-M. or --workersN-M. for workers in the range N to M

For example:

  • --worker0.searchType FDS sets the search type to the first worker only.
  • --workers4-8.noOverlapPropagationLevel 4 sets the propagation level of noOverlap constraint for workers 4, 5, 6, 7, and 8. For example, --worker0.searchType FDS sets the search type to the first worker only.

See