Skip to main content

Type Alias: BenchmarkParameters

BenchmarkParameters: Parameters & { dontOutputSolutions: boolean; exportDomains: string; exportJS: string; exportJSON: string; exportText: string; log: string; maxObjective: number; minObjective: number; nbParallelRuns: number; nbSeeds: number; output: string; result: string; solve: boolean; summary: string; }

Type declaration

dontOutputSolutions?

optional dontOutputSolutions: boolean

Don't include solutions in the output file.

Remarks

When set to true, solutions are not included in the file specified by the output parameter. This can save a lot of disk space when benchmarking large problems or running many benchmark runs.

exportDomains?

optional exportDomains: string

Filename pattern for exporting domains after propagation.

Remarks

When set, the variable domains after initial propagation are exported to a text file. This is useful for debugging and understanding the problem structure.

See BenchmarkParameters for details on filename patterns.

exportJS?

optional exportJS: string

Filename pattern for exporting the model into JavaScript.

Remarks

When set, the model is exported to JavaScript using function Model.toJS. The problem is solved before exporting (unless parameter solve is set to false). If a solution is found, it is included in the exported code as a warm start.

See BenchmarkParameters for details on filename patterns.

exportJSON?

optional exportJSON: string

Filename pattern for exporting the problem into JSON format.

Remarks

When set, the problem is exported to JSON format using function Model.toJSON. The problem is solved before exporting (unless parameter solve is set to false). If a solution is found, it is included in export as a warm start.

See BenchmarkParameters for details on filename patterns.

exportText?

optional exportText: string

Filename pattern for exporting the problem into text format.

Remarks

When set, the problem is exported to text format using function Model.toText. The problem is solved before exporting (unless parameter solve is set to false). If a solution was found, it is included in the exported text.

See BenchmarkParameters for details on filename patterns.

log?

optional log: string

Filename pattern for log files.

Remarks

When set, every benchmark run is logged to a separate file. The filename can contain patterns that are replaced with run-specific values:

  • {name} - the name of the model (see Model.name)
  • {seed} - the seed used for the run
  • {flat_name} - the model name with / replaced by _

See BenchmarkParameters for more details on filename patterns.

maxObjective?

optional maxObjective: number

Constrain the objective to be less or equal to the given value.

Remarks

When set, the solver adds a constraint that the objective value must be at most this value. This is useful when you know an upper bound on the optimal objective from previous runs or theoretical analysis.

minObjective?

optional minObjective: number

Constrain the objective to be greater or equal to the given value.

Remarks

When set, the solver adds a constraint that the objective value must be at least this value. This is useful when you know a lower bound on the optimal objective from previous runs or theoretical analysis.

nbParallelRuns?

optional nbParallelRuns: number

Run up to the specified number of solves in parallel.

Remarks

When set, multiple benchmark runs are executed in parallel, up to the specified limit. This can significantly speed up benchmarking on multi-core machines.

Make sure that you limit the number of workers in all models using parameter Parameters.nbWorkers. For example, if you have 8 cores and set nbParallelRuns to 4, you should set nbWorkers to 2 in each model.

nbSeeds?

optional nbSeeds: number

Run each model multiple times with a different random seed.

Remarks

When set, the model is solved multiple times, each time with a different random seed. This is useful for benchmarking to get statistically significant results.

The seed is available in filename patterns as {seed}.

output?

optional output: string

Filename for detailed results of all benchmarks.

Remarks

When set, detailed results of all benchmark runs are written to the specified file in JSON format. The result is an array of BenchmarkResult.

This is different from result which writes each run to a separate file using a filename pattern.

result?

optional result: string

Filename pattern for results of a benchmark.

Remarks

When set, the result of each benchmark run is stored in a separate file in JSON format as BenchmarkResult. The filename can contain patterns that are replaced with run-specific values.

See BenchmarkParameters for details on filename patterns.

solve?

optional solve: boolean

Whether to solve the model(s).

Remarks

The value can be true, false, or undefined. The function Model.solve is not called only if the value is false.

Not calling solve can be useful in combination with exportJSON, exportText, or exportJS when you want to export the model without solving it.

summary?

optional summary: string

Filename for a summary of all benchmarks in CSV format.

Remarks

When set, a summary of all benchmark runs is written to the specified file in CSV format. There is one line for each benchmark run, containing key metrics such as solve time, objective value, and solution status.

Remarks

Extension of Parameters that can be used to parameterize function benchmark.

The parameters are the same as in Parameters with some additions that control the behavior of function benchmark. In particular, there are parameters that allow storing the output in file(s), running the model multiple times with multiple seeds, etc.

Parameters can also be parsed from command line arguments using function parseBenchmarkParameters or parseSomeBenchmarkParameters.

Filename patterns

Some parameters can specify a filename pattern. Patterns allow the generation of a unique file name for each benchmark run. The pattern is a string that can contain the following placeholders:

  • {name} - the name of the model (see Model.name). If the model name is not set (it is undefined), then a unique name is generated.
  • {seed} - the seed used for the run. Useful, especially in combination with nbSeeds parameter.
  • {flat_name} - the name of the model with all characters '/' replaced by '_'.