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.

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 log stream.

10.2 File I/O

MOSEK supports a range of problem and solution formats listed in Sec. 18 (Supported File Formats). One such format is MOSEK’s native binary Task format which supports all features that MOSEK supports.

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 mosekopt 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

This will write the problem in prob to the file datafile.opf.

When using MATLAB-like functions, as for instance linprog, control parameters can be set using the options structure, for example,

options.Write = 'test.opf';

which will also write the problem to an opf-formatted file before optimizing.

10.3 Verbosity

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 MSK_IPAR_LOG and MSK_IPAR_LOG_INTPNT.

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 MSK_IPAR_LOG.

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.