# 1 Technical Issues¶

How do I dump the problem to a file to attach with my support question?

Just before optimization do:

 Fusion API C++ M->writeTask("dump.task.gz"); Java M.writeTask("dump.task.gz"); .NET M.WriteTask("dump.task.gz"); Python M.writeTask("dump.task.gz") MATLAB M.writeTask('dump.task.gz') Optimizer API C MSK_writetask(task, "dump.task.gz"); Java task.writetask("dump.task.gz"); .NET task.writetask("dump.task.gz"); Python task.writetask("dump.task.gz") MATLAB Toolbox mosekopt('write(dump.task.gz)',prob) Rmosek r <- mosek_write(prob, "dump.task.gz") Command line mosek input_file -out dump.task.gz Third party cvx cvx_solver_settings('write', 'dump.task.gz') YALMIP sdpsettings('savedebug',1) followed by load('mosekdebug') mosekopt('min write(dump.task.gz)', prob, param) choose min or max depending on the problem

I am using a third-party interface to MOSEK. How do I set solver parameters?

• CVXPY. When invoking the solver, pass a dictionary mosek_params with pairs parameter: value. For example

prob.solve(solver=cvxpy.MOSEK, mosek_params={mosek.iparam.num_threads: 1})


will limit the number of threads to 1.

On Mac OS I get errors about missing libmosek64.8.1.dylib or similar files.

Most likely you forgot to run the Mac OS installation script as described in the installation manual. Go to the bin directory of your MOSEK installation and run

python2 install.py


When using the Python interface I get a RuntimeWarning: Item size computed from the PEP 3118.

This is caused by a bug in the CTypes module in Python 2.7 and 3.x, related to Issue 10744 and Issue 10746 . These issues are only registered as being related to Python 3.1+, but the ctypes code from 3.x is routinely back-ported to 2.7. The problem is that CTypes reports the size and shape of arrays correctly, but provides a wrong element formatting string: Numpy and other libraries may check this and issue a warning. The bug appears to be harmless; we know of no cases where the invalid information is used.

Can the C API be used from Fortran?

MOSEK has no official support for FORTRAN, but if the FORTRAN compiler supports C calling convention it should be possible use to the C API. The appropriate FORTRAN compiler documentation will have to tell you how to do it.

Can MOSEK run on virtualized server such as VmWare server?

Yes, MOSEK runs fine on a virtualized server. However, particularly when solving large problems, MOSEK can exploit all the resources of computer and hence using a virtualized server may cost performance. If performance is important it is recommended to test whether MOSEK runs as fast on the virtualized server as on a native server for the relevant applications.

How do I write an MPS file using GAMS and MOSEK?

GAMS can write native MPS files but they do not include any nonlinear information so they are not useful for nonlinear problems. However, it is possible to MPS files using MOSEK as follows. Create a file name mosek.opt that has the content

MSK_SPAR_DATA_FILE_NAME somename.mps


and then execute the command gams mygamsprogram. MOSEK should now write the file somename.mps.

Does MOSEK work with MinGW?

Yes. MOSEK includes libraries that are compatible with MinGW and MinGW-w64 . Applications built with MinGW should link with mosek7_0.lib and libmosek64_7_0.a on the platforms win32x86 and win64x86 respectively. The native import library (.lib) will not work on 64bit Windows.

Does MOSEK support Cygwin?

No. Cygwin is not supported. An alternative to using Cygwin is the use of MinGW toolchain that is supported by MOSEK.

# 2 Modeling Issues¶

MOSEK is not solving my quadratic optimization problem fast enough. What should I do?

Can MOSEK solve nonconvex problems?

MOSEK cannot solve continuous non-convex optimization problems, and if non-convexity is detected, the solver will terminate. MOSEK may not always be able to detect non-convexity, but we strongly recommend not to apply MOSEK to non-convex problems.

Can MOSEK handle SOS (or SOS2) sets in mixed integer optimization?

MOSEK has no special support for SOS1 or SOS2 (special ordered sets). Note that SOS1 can easily be implemented with linear constraints of the form $$x_1 + x_2 + \ldots \leq 1$$

Why does MOSEK not report a dual solution when I have solved a mixed integer problem?

In general, the dual problem corresponding to a mixed-integer problem is not well-defined. In some cases the desired dual solution is the one obtained by fixing all integer variables at their optimal solution values and re-solving the problem with the continuous optimizer.

Can I get the solution MOSEK produce in every iteration of the optimizer?

No. Since MOSEK performs a lot of transformations on the problem before starting to solve it, the intermediate solution values may make little sense in the context of the user-specified problem. These solution values are not made available.

Can the MOSEK interior-point optimizers be hot-started?

No, since there are no known generally reliable ways to hot-start interior-point methods. This is an open research topic.

Why do not I get a good speedup when using multiple threads?

There are many reasons why a good speedup cannot be achieved when using more threads. Some of them are:

• Not all operations can be parallelized, as for instance the presolve phase.
• There is an overhead associated with using multiple threads because coordinating the multiple threads requires some management operations which cost some of the computational performance. This is particular visible if more threads than the number of cores is employed.
• Assume you are parallelizing the inner product of two long vectors using two threads. Now each thread will have to move data from main memory to CPU. Since the amount data that can be moved from main memory and to the CPUs is limited then data movement easily becomes the bottleneck. This will limit the potential speedup.
• For many operations such as matrix multiplication then the sequential version runs relatively faster the larger the matrices are. Now if matrix multiplication is parallelized then one big matrix multiplication is replaced by several small ones leading to a loss of efficiency compared to the sequential one. Hence, a linear speedup is not archived.
• Some recent CPUs may boost the clock frequency if the CPU is not loaded too heavily. This is likely to be the case if only one thread is employed. See Intel’s explanation for details. This will of course offset some of the benefits of using multiple threads.

To summarize obtaining a linear speedup when using multiple threads is nearly impossible. In fact in many cases it is not possible to obtain any speedup if the job to be parallelized is small.

Why does MOSEK not produce the same solution for a problem when using multiple threads?

Solving the same problem repeatedly using multiple threads may produce different results, although optimal objective values will be the same. This is a well known side effect of the non-determinism introduced by using multiple threads: The operating system decides when a thread is serviced and in which order they are serviced. Moreover, in repeated runs, the threads are unlikely to be serviced in the same order each time.

But why does it affects the the computations? The explanation is as follows: Numerical computation are done in finite precision, hence rounding errors appear. This implies that the associative law $$(a+b)+c = a+(b+c)$$ does not always hold, and that the order in which the computations are performed affects the result. In other words, since performing computations in multiple threads introduce a randomness in the order of the computations, the result is not deterministic.

As of MOSEK version 7 the interior-point optimizer for linear and conic problems should be from run-to-run deterministic.

Is the simplex optimizer in MOSEK parallelized?

The simplex optimizers in MOSEK are not parallelized and hence cannot exploit multiple threads. The iterations in the simplex algorithm very serial in nature, and each iteration performs so little work that they cannot efficiently be parallelized. To our knowledge, high-performance large scale parallel simplex is currently unavailable.

Is the mixed integer optimizer parallelized in MOSEK?

Yes, the branch-and-bound algorithm is parallelized. Moreover, each relaxation can be solved in parallel using either the concurrent optimizer or the parallelized interior-point optimizer.

My license file says VER=8.0. Can I use version 8.1?

Yes. Only the major version number matters.

After you put the license file in the right place restart Matlab. It caches the license.

Can a MOSEK license be used under Citrix?

This is not a case that we test for, but MOSEK employs a floating license scheme by default and that works under Citrix.

The lmutil and lmgrd will not start on Linux: No such file or directory.

If you run a command from the licensing system and get this error:

user@hostname:~/path_to_mosek\$ ./lmutil
./lmutil: No such file or directory


then most likely the Standard Base (LSB) package version 3 or newer is not installed on your system. On Ubuntu the latest version of LSB can be installed with the command apt-get install lsb.

Is it possible to reserve a number licenses to particular group of users or hosts?

Yes it is. To reserve a certain number license features for a particular user or IP address, you must add lines like

RESERVE num_lic feature[:keyword=value] type {name | group_name}


Is it possible to use MOSEK on a machine detached from the LAN(WAN)?

Yes. Either the license can be tied to USB dongle or it is possible to use the lmborrow functionality. See the FLEXnet license administration guide .

How many license token servers should I have?

All MOSEK licenses are floating. That means if you install one license on one computer the computer can act as a token server for itself. In reality it will often be easier and more economical to use few shared token servers rather than one per MOSEK installation. Each token server would require at least one license, and often this would mean that each license is free most of the time. A best practice is to employ one or two token servers for each site, where 2 token servers are employed if licenses for development and production should be kept separate.

The token server will not start under Ubuntu.

Flexlm needs the directory /usr/tmp to exists and have write access by the user running lmgrd.

Is it possible to host a token server on Amazon Cloud?

It is definitely possible, although some specific steps must be performed. Please see the licensing guide for details.

# 4 Miscellanea¶

How do I cite MOSEK in an academic publication?

The preferred way to cite MOSEK is to use a BibTex entry as

@manual{mosek,
author = "MOSEK ApS",
title = "XXX",
year = 2015,
url = "YYY"
}


where YYY is the link to the relevant manual of the specific API used, and XXX is the title of the manual main page. For instance, citing the MATLAB toolbox would result in

@manual{mosek,
author = "MOSEK ApS",
title = "The MOSEK optimization toolbox for MATLAB manual. Version 7.1 (Revision 28).",
year = 2015,
url = "http://docs.mosek.com/7.1/toolbox/index.html"
}


The same applies for all other material we provide on the web site.