In this section we discuss how to install and setup the MOSEK Optimization Toolbox for MATLAB.
Before running this MOSEK interface please make sure that you:
The Optimization Toolbox for MATLAB can be used with MATLAB version r2014a or newer.
The files in Optimization Toolbox for MATLAB are organized as reported in Table 4.1.
||Toolbox (without overloading)||
<MSKHOME> is the folder in which the MOSEK package has been installed.
Setting up the paths
To use Optimization Toolbox for MATLAB the path to the toolbox directory must be added via the
addpath command in MATLAB. Use the command
On the Windows platform the relevant paths are
addpath <MSKHOME>\mosek\8\toolbox\r2014a addpath <MSKHOME>\mosek\8\toolbox\r2014aom
Alternatively, the path to Optimization Toolbox for MATLAB may be set from the command line or it can be added to MATLAB permanently using the configuration file
startup.m or from the FileSet Path menu item. We refer to MATLAB documentation for details.
4.1 Testing the installation¶
You can verify that Optimization Toolbox for MATLAB works by executing
in MATLAB. This should produce a message similar to this:
Matlab version: 184.108.40.2062 (R2014a) Architecture : GLNXA64 Warning: The mosek optimizer could not be invoked from the command line. Most likely the path has not been configured correctly. The mosek optimizer can still be invoked from the MATLAB environment. > In mosekdiag at 23 mosekopt: /home/andrea/mosek/8/toolbox/r2014a/mosekopt.mexa64 MOSEK Version 220.127.116.11(BETA) (Build date: 2016-8-16 00:52:47) Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com Platform: Linux/64-X86 Found MOSEK version : major(8), minor(0), build(0), revision(34) mosekopt is working correctly. Warning: MOSEK Fusion is not configured correctly; check that mosek.jar is added to the javaclasspath.
If you only want to use Optimization Toolbox for MATLAB then the warnings about command line and Fusion interface can be ignored.
Undefined Function or Variable mosekopt
If you get the MATLAB error message
Undefined function or variable 'mosekopt'
you have not added the path to the Optimization Toolbox for MATLAB correctly as described above.
For certain versions of Windows and MATLAB, the path to MEX files cannot contain spaces. Therefore, if you
have installed MOSEK in
C:\Program Files\Mosek and get a MATLAB error similar to:
Invalid MEX-file <MSKHOME>\Mosek\8\toolbox\r2014a\mosekopt.mexw64
try installing MOSEK in a different directory, for example
Output Arguments not assigned
If you encounter an error like
Error in ==> mosekpt at 1 function [r,res] = mosekopt(cmd,prob,param,callback) Output argument "r" (and maybe others) not assigned during call to "C:\Users\andrea\mosek\8\toolbox\r2014a\mosekopt.m>mosekopt".
then a mismatch between 32 and 64 bit versions of MOSEK and MATLAB is likely. From MATLAB type
which (for a succesful installation) should point to a MEX file,
and not to a MATLAB