CVX

From HPC users
Revision as of 16:12, 10 April 2017 by Harfst (talk | contribs) (Created page with "CVX is a Matlab-based modelling system for convex optimization. CVX turns Matlab into a modelling language, allowing constraints and objectives to be specified using standard ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

CVX is a Matlab-based modelling system for convex optimization. CVX turns Matlab into a modelling language, allowing constraints and objectives to be specified using standard Matlab expression syntax.[1] Please read the license information before using CVX on the HPC cluster.

CVX can be used on CARL and EDDY within Matlab. Currently, CFX is usable in version 2016b.

If you use CVX for the first time, you need to add the file

cvx_prefs.mat

to the Matlab settings in your $HOME directory. This can be done by running the commands

module load MATLAB/2016b
matlab -nodisplay -r "cvx_init_prefs( false ); exit"

after you should see the file

$HOME/.matlab/cvx_prefs.mat

You only need to this once.

You can test whether CVX can be used by starting Matlab

matlab -nodisplay

(load the module first if you have not) and then execute these lines of code (taken from [2])

m = 20; n = 10; p = 4;
A = randn(m,n); b = randn(m,1);
C = randn(p,n); d = randn(p,1); e = rand;
cvx_begin
    variable x(n)
    minimize( norm( A * x - b, 2 ) )
    subject to
        C * x == d
        norm( x, Inf ) <= e
cvx_end

which should produce some output ending with

Status: Solved
Optimal value (cvx_optval): +4.77539

Once CVX is working for you you should be able to use it with in your Matlab jobs which you can submit using MDCS.