Function: parseSomeParameters()
parseSomeParameters(
params
:Parameters
,args
:string
[]):string
[]
Parses command-line solver parameters and returns array of unrecognized arguments.
Parameters
Parameter | Type | Description |
---|---|---|
params | Parameters | The input/output object. The function will overwrite the parameters with values specified on the command line. |
args | string [] | The command-line arguments to parse. If not specified then process.argv.slice(2) is used. |
Returns
string
[]
An array of unrecognized arguments.
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 modifies the input params object accordingly. It returns an array of unrecognized arguments that were not parsed.
The function is similar to parseParameters but it does not stop
if an unrecognized parameter is encountered. Instead, it returns an array of
unrecognized arguments. The caller can then decide what to do with them.
The function can still call process.exit(1)
if another type of error is
encountered.
The parameter params
is input/output. It may contain default setting that
will be overwritten during parsing.
If --help
or -h
is given then the function prints help and calls
process.exit(0)
. The printed help is created by concatenating params.usage
and 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
- parseParameters for a similar function that don't accept unrecognized arguments.
- functions parseBenchmarkParameters and parseSomeBenchmarkParameters for for parsing BenchmarkParameters.