Saving parameter settings to a file in the C API
Users of the Callable Library (C API) can save current parameter settings in a PRM file.
You can read and write a file of parameter settings with
the C API. The file extension is .prm
.
The C routine CPXreadcopyparam
reads parameter
values from a file with the .prm
extension.
The routine CPXwriteparam
writes a file
of the current non-default parameter settings to a file with the .prm
extension. Here is the format of such a file:
CPLEX Parameter File Version number
parameter_name parameter_value
The heading with a version number in the first line of a PRM file is significant to CPLEX. An easy way to produce a correctly formatted PRM file with a proper heading is to have CPLEX write the file for you.
CPLEX reads the entire file before changing any of the parameter settings. After successfully reading a parameter file, the C API first sets all parameters to their default value. Then it applies the settings it read in the parameter file. No changes are made if the parameter file contains errors, such as missing or illegal values. There is no checking for duplicate entries in the file. In the case of duplicate entries, the last setting in the file is applied.
When you create a parameter file from the C API, only the non-default values are written to the file. You can double-quote string values or not when you create a PRM file, but CPLEX always writes string-valued parameters with double quotation marks.
The comment character in a parameter file is #. After that character, CPLEX ignores the rest of the line.
The C API issues a warning if the version recorded in the parameter file does not match the version of the product. A warning is also issued if a nonintegral value is given for an integer-valued parameter.
Here is an example of a correct CPLEX parameter file:
CPLEX Parameter File Version 11.0
CPX_PARAM_EPPER 3.45000000000000e-06
CPX_PARAM_OBJULIM 1.23456789012345e+05
CPX_PARAM_PERIND 1
CPX_PARAM_SCRIND 1
CPX_PARAM_WORKDIR "tmp"
The environment variable
ILOG_CPLEX_PARAMETER_FILE
lets you specify the
existence and location of a PRM file to CPLEX.