Can we students now use Mosek freely in CVX? If so, how can I install it? I followed the guide but it could not work. It seems that they have not implemented mosek into CVX for academic use, am I right? Thanks!
Yes, you can use MOSEK now. In order to do so, you must install it yourself, obtain an academic license, and ensure that it is properly configured to be called within MATLAB. Once you have MOSEK fully installed, you can run
cvx_setup and it will detect the presence of MOSEK and use it.
Please see the MOSEK web site for details; specifically:
- the download page
- the installation guide
- the trial license page, where you can also find instructions for acquiring an academic license.
Once you have properly installed MOSEK, typing
mosekopt on the MATLAB command line will produce an output something like this:
MOSEK Version 188.8.131.52 (Build date: 2011-11-18 15:41:03) Copyright (c) 1998-2011 MOSEK ApS, Denmark. WWW: http://www.mosek.com For help type: help mosekopt.
Once you see that, run (or re-run)
cvx_setup, and CVX will detect the presence of MOSEK and configure itself to use it. You will then be able to use
cvx_solver mosek to select MOSEK for your models.
We are currently working with MOSEK to arrange to include a special version of MOSEK as part of the CVX package itself. There are still a number of contractual and technical details for us to work out before we can do that, however, so in the meanwhile a separate install of MOSEK is your only option.
Additional information that might help you: when following the MOSEK installation guidelines in the section “2. Installing the software” at this mosek installation website, it will instruct you to add some environment variables. For example, for linux, it will tell you to add the variables to your
~/.bashrc file. This does not always get passed on to Matlab – you can check if it worked by restarting Matlab and running
getenv('MOSEKLM_LICENSE_FILE'). If you don’t see anything, then you have to fix it. In linux, you can edit
~/.matlab7rc.sh the same way you edited
~/.bashrc. Or, for any distribution, you can edit your
startup.m file to run a command like
setenv('MOSEKLM_LICENSE_FILE','(location to mosek.lic)' ).
Similarly, check that Mosek is in your
LD_LIBRARY_PATH variable. You can set this by
setenv('LD_LIBRARY_PATH', [getenv('LD_LIBRARY_PATH') ':' '(location to your mosek .so or .dll library files)' ] );
The situation with Gurobi is the same. Use the above techniques to add the environment variable
GUROBI_HOME, and also add the Gurobi library locations to
something else I missed in the documentation:
to get the mosekopt to work inside Matlab, you must also add the toolbox folder in mosek/ to your Matlab
Yes, that’s correct. The bottom line is that MOSEK must already be working in Matlab when
cvx_setup is run, or CVX will not be able to detect it.
Thanks for these information.
I typed the command: mosekopt, and it produced this output
MOSEK Version 184.108.40.206 (Build date: 2012-10-26 09:00:23) Copyright (c) 1998-2012 MOSEK ApS, Denmark. WWW:http://www.mosek.com
which means that Mosek is working properly. Then I typed the command cvx_setup, and it produced ONLY this output:
Testing the cvx distribution. If this script aborts with an error, please report the error to the authors. ------------------------------------------------------------- No errors! cvx has been successfully installed. NOTE: The MATLAB path has been updated to point to the cvx distribution. In order to use cvx regularly, you must save this new path definition. To accomplish this, add these lines to your startup.m file: rmpath d:\cvx\cvx\sets rmpath d:\cvx\cvx\keywords rmpath d:\cvx\cvx\builtins rmpath d:\cvx\cvx\commands rmpath d:\cvx\cvx\functions rmpath d:\cvx\cvx\lib rmpath d:\cvx\cvx\structures rmpath d:\cvx\cvx addpath d:\cvx\cvx addpath d:\cvx\cvx\structures addpath d:\cvx\cvx\lib addpath d:\cvx\cvx\functions addpath d:\cvx\cvx\commands addpath d:\cvx\cvx\builtins Consult the MATLAB documentation if necessary.
which means that CVX is working properly.
However, when I type the command cvx_solver mosek, the following error message appears:
Error using cvx_solver (line 34) Unknown, unusable, or missing solver: mosek
What Does that mean?
I don’t have a professional licence. Is this the source of the problem?
Thanks in advance.
Please edit this post with the full output of
cvx_setup, not just the last few lines.
You should probably update to MOSEK 7…
The “bundled” version of MOSEK that I mentioned above is coming very soon. This will greatly simplify the process of installing CVX with MOSEK support.
I installed an academic License and the problem is now solved. Thanks for your attention.
I also experience problems getting cvx_setup recognize MOSEK version 7 (although mosekopt runs fine). I get the error: 1 solver skipped:
A CVX Professional license is required.
Do you have a professional license for CVX yet? If not, get one. If so, please file a bug report and include your license file as an attachment. Without a license the new version if CVX will not work for you either.
Mosek provides free academic license without recognizing hostname. Why CVX needs to recognize hostname?
I strongly recommend you use MOSEK version 7 and not the older version. It is much easier to setup and include support for SDP.
Using the default in installation in MOSEK version 7 no OS variables has to be set on Linux and OSX :-).
I have tried but the CVX professional license is needed if I want to use mosek solver in CVX.
This license is free for academics.
I installed the cvx professional license but it does not work and still skips the solver mosek. But Gurobi is installed using this license.
My suspicion is that your CVX license is invalid. Gurobi has a separate parallel check for academic status. What does the “status” line of the license info say when you run cvx_setup?
Status: invalid:hostid,user …