8 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 8.1 contains information about the log streams provided by MOSEK.
  • File I/O is discussed in Section 8.2.
  • How to tune the logging verbosity is the topic of Section 8.3.

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

8.2 File I/O

MOSEK supports a range of problem and solution formats listed in Section 13. 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 mosek_write function to write the problem to a file immediately before optimizing it:

r <- mosek_write(lo1, "lo1.opf")

This will write the problem in lo1 to the file lo1.opf. Similarly, using mosek_read is possible to read a problem from file. For instance the following code line

r <- mosek_read("lo1.opf")

will import a problem stored in the file lo1.opf in an object called prob.

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