CVX Installation
...
Instructions
CVX is Matlab-based modelling language, primarily for constructing and solving convex optimization problems. (See http://cvxr.com/cvx/ for more details.) Although installing CVX is fairly straightforward, this page summarizes the key steps. If you come across any problems or issues, please see "Questions, Comments and Common Problems" below.
...
- Mac users should use the "UNIX" files .tar.gz files.
- You only need to follow the sections labeled "Supported Platforms" and "Installation Instructions." The sections "Installing a CVX Professional License" and "Using CVX with Gurobi or MOSEK" are optional and not required for Software Tools Class . (See below for more details.)
- The instructions may suggest creating a "startup.m" file if you're on a UNIX system. (If you're on Windows, this may not happen.) This is a configuration file for MATLAB so that it will always know where to look for CVX functions. We also recommend adding one.
- Look in your "MATLAB" folder. It might be in a location like: "/Users/<your username>/Documents/MATLAB"
- If you already have a startup.m file, great! If not, create a blank document named startup.m in this location.
- Add the following code to your startup.m file
addpath <path to MATLAB cvx folder>/MATLAB/cvx
addpath <path to MATLAB cvx folder>/MATLAB/cvx/structures
addpath <path to MATLAB cvx folder>/MATLAB/cvx/lib
addpath <path to MATLAB cvx folder>/MATLAB/cvx/functions
addpath <path to MATLAB cvx folder>/MATLAB/cvx/commands
addpath <path to MATLAB cvx folder>/MATLAB/cvx/builtins
replacing < path to MATLAB cvx folder > as appropriate.
Testing your CVX Installation
You should test your installation after installing to confirm everything works. The easiest way to do this is to navigate to:
_ /Users/VGupta/Documents/MATLAB/cvx/examples _
and run the file simple_LP.m.
The file creates a small linear program (with random coefficients) and solves it. (Look through the code. It is very readable.) If all goes well, it should produce some output like this:
Calling sedumi: 100 variables, 50 equality constraints
------------------------------------------------------------
SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
eqs m = 50, order n = 101, dim = 101, blocks = 1
nnz(A) = 5000 + 0, nnz(ADA) = 2500, nnz(L) = 1275
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 2.15E+00 0.000
1 : -1.79E-01 8.07E-01 0.000 0.3755 0.9000 0.9000 -0.34 1 1 2.0E+01
2 : 5.26E-01 2.55E-01 0.000 0.3164 0.9000 0.9000 0.86 1 1 5.8E+00
3 : 6.06E-01 8.08E-02 0.000 0.3166 0.9000 0.9000 1.34 1 1 1.5E+00
4 : 1.17E+00 3.08E-02 0.000 0.3810 0.9000 0.9000 1.48 1 1 4.7E-01
5 : 1.71E+00 1.55E-02 0.000 0.5046 0.9000 0.9000 1.35 1 1 2.1E-01
6 : 1.93E+00 6.81E-03 0.000 0.4385 0.9000 0.9000 1.21 1 1 8.7E-02
7 : 2.10E+00 2.89E-03 0.000 0.4236 0.9000 0.9000 0.91 1 1 4.1E-02
8 : 2.24E+00 9.22E-04 0.000 0.3193 0.9000 0.9000 0.73 1 1 1.4E-02
9 : 2.29E+00 1.97E-04 0.000 0.2140 0.9000 0.9000 1.05 1 1 2.9E-03
10 : 2.29E+00 5.97E-05 0.000 0.3027 0.9000 0.9000 0.98 1 1 8.8E-04
11 : 2.30E+00 2.34E-06 0.000 0.0392 0.9900 0.9602 1.01 1 1
iter seconds digits c*x b*y
11 0.1 13.2 2.2983746112e+00 2.2983746112e+00
Ax-b
= 8.8e-13, Ay-c_+ = 1.5E-12,
x
= 7.3e+00,
y
= 5.6e+00
Detailed timing (sec)
Pre IPM Post
2.000E-02 9.000E-02 0.000E+00
Max-norms: ||b||=2.043044e+00, ||c|| = 2.290580e+00,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 3.33535.
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.714152
The precise optimal value may be different in your run since the coefficients used are random.
Connecting CVX to Gurobi
Connecting CVX to Gurobi (Optional)
Connecting CVX to Gurobi is optional and will not be needed for our session. It is pretty easy to do, though, and if you plan on solving Integer Programs through Matlab, you SHOULD do it.
For now, consult the website for details. When I have time, I will add details here.
Testing your installation instructions
Don't forget to Test your installation To be added.
Questions, Comments and Common Problems
...