10 Managing I/O¶
The main purpose of this chapter is to give an overview on the logging and I/O features provided by the MOSEK package.
- Section 10.1 contains information about the log streams provided by MOSEK.
- File I/O is discussed in Section 10.2.
- How to tune the logging verbosity is the topic of Section 10.3.
10.1 Stream I/O¶
MOSEK execution produces a certain amount of loggging at environment and task level. This means that the logging from each environement and task can be isolated from the others.
The log messages are partitioned in three streams:
These streams are aggregated in the
10.2 File I/O¶
The file format used in I/O operations is deduced from extension - as in
problemname.task - unless the parameter
MSK_IPAR_WRITE_DATA_FORMAT is specified to something else.
Problem files with an additional
.gz extension - as in
problemname.task.gz - are moreover assumed to use GZIP compression, and are automatically compressed, respectively decompressed, when written or read.
If something is wrong with a problem or a solution, one option is to output the problem to the human-readable OPF format and inspect it by hand. For instance, one may use the
function to write the problem to a file immediately before optimizing it:
% Write the data defined by prob to an OPF file % named datafile.mps mosekopt('write(datafile.opf)',prob);
This will write the problem in
prob to the file
When using MATLAB-like functions, as for instance
linprog, control parameters can be set using the
options structure, for example,
options.Write = 'test.opf'; linprog(f,A,b,B,c,l,u,x0,options);
which will also write the problem to an
opf-formatted file before optimizing.
The logging verbosity can be controlled by setting the relevant paramenters, as for instance
Each parameter control the output level of a specific functionality or algorithm. The main switch is
MSK_IPAR_LOG which affect the whole output. The actual log
level for a specific functionality is determined as the minimum between
MSK_IPAR_LOG and the relevant parameter. For instance, the log level for the output produce by the interior-point algorithm is tuned by the
MSK_IPAR_LOG_INTPNT: the actual log level is defined by the minimum between
Tuning the solver verbosity may require adjusting several parameters. It must be noticed that verbose logging is supposed to be of interest during debugging and tuning, and it is consider the default setting. When output is no more of interest, user can easily disable using
Moreover, it must be understood that larger values of
MSK_IPAR_LOG do not necessarily result in an increased output.
By default MOSEK will reduce the amount of log information after the first optimization on a given task. To get full log output on subsequent optimizations set
MSK_IPAR_LOG_CUT_SECOND_OPT to zero.