batch_tune#
- batch_tune(*model_files, log_output=True, overall_timelimit_sec=None, tuning_timelimit_sec=None, overall_timelimit_det=None, tuning_timelimit_det=None, display_level=None, measure=None, fixed_params_and_values=None)#
Run tuning tests on a batch of models to search for performance-improving parameter settings.
This function is a wrapper around CPLEX’s tuning tool. Refer to the CPLEX user manual for more details about this functionality.
- Parameters:
- *model_filesstr
Path of file containing the model. Supported formats are
.mps,.lp, and.sav(compressed files with extensions.gzand.bz2are also supported).- log_outputbool or str or stream object, optional
Log output switch, in one of the following forms:
Trueor'1'or'stdout'or'sys.stdout': Log is output to stdout.'stderr'or'sys.stderr': Log is output to stderr.Falseor'0'orNone: No log output.File path (in form of str): Log is output to the file.
Stream object (a file-like object with a write method and a flush method): Log is output to the stream object.
Default is
True.- overall_timelimit_secint or float or str, optional
Time limit for the tuning tool, in terms of seconds. Corresponds to the CPLEX parameter timelimit.
- tuning_timelimit_secint or float or str, optional
Time limit for each test of the tuning tool, in terms of seconds. Corresponds to the CPLEX parameter tune.timelimit.
- overall_timelimit_detint or float or str, optional
Time limit for the tuning tool, in terms of deterministic ticks. Corresponds to the CPLEX parameter dettimelimit.
- tuning_timelimit_detint or float or str, optional
Time limit for each test of the tuning tool, in terms of deterministic ticks. Corresponds to the CPLEX parameter tune.dettimelimit.
- display_levelint, optional
Level of information reported by the tuning tool as it works. Corresponds to the CPLEX parameter tune.display.
- measureint, optional
Measure for evaluating progress. Corresponds to the CPLEX parameter tune.measure.
- fixed_params_and_valuesdict, optional
Set of parameters and their values that should be respected by the tuning tool, in form of a dict having parameter names (as str such as ‘lpmethod’, ‘mip.limits.cutpasses’, etc.) as keys and parameter values as values. Default is
None.
- Returns:
- dict
Set of performance-improving parameters and their values identified by tuning tool, in form of a dict having parameter names (as str such as ‘lpmethod’, ‘mip.limits.cutpasses’, etc.) as keys and parameter values as values.
- Raises:
- FileNotFoundError
If model file is not found.
- ValueError
If both overall_timelimit_sec and overall_timelimit_det are specified.
- ValueError
If both tuning_timelimit_sec and tuning_timelimit_det are specified.
- ValueError
If an invalid value is specified for any tuning parameter in function arguments: overall_timelimit_sec, tuning_timelimit_sec, overall_timelimit_det, tuning_timelimit_det, display_level, measure.
- ValueError
If an invalid parameter or value is specified is fixed_params_and_values.
See also
tuneFor tuning a DOcplex model.
Notes
Although the tuning tool can tune a single model through this function, it cannot access the CPLEX parameter tune.repeat. Use the
docplex_extensions.tunefunction instead to use this parameter.