Matlab Out Of Memory Error

Hi all, I’m trying to resolve my optimization problem with CVX, and I get Out of Memory error which I gave below

Out of memory.

Error in cvxprob/eliminate (line 179)
P = P( :, colX ) + P( :, cols ) * temp;

Error in cvxprob/solve (line 18)
[ At, cones, sgn, Q, P, dualized ] = eliminate( prob, true, shim.dualize );

Error in cvx_end (line 88)
solve( prob );

Error in invtest2 (line 182)
cvx_end

My cvx code is;

tol=1e-40;
sigma2=5e-10;
lamda2=0.001;
lamda=0.08;
sigma3=20;
sigma=1;
lamda3=100;

n=length(B(1,:));
cvx_begin quiet
    cvx_solver mosek
variable a(n)
 minimize( norm(w*a,1) + lamda*((norm(Ux*a , 2))) + (norm(Uy*a, 2))*lamda2+lamda3*(norm(Uz*a,2)))

    subject to
(norm(B*a-Stec,2))/ (norm(Stec,2)) <= tol


cvx_end

Here U, Ux,Uy,Uz, w 15876x15876 matrices, B 146x15876 ,Stec 146x1 matrices. I know these all very large. When I run my code with 8820x8820 matrices, 146x8820 B matrix and 146x1 Stec vetor the code is running well. But I need to run with the large elements. Can you give me any suggestion?

My computer memory is;

memory
Maximum possible array: 13681 MB (1.435e+10 bytes) *
Memory available for all arrays: 13681 MB (1.435e+10 bytes) *
Memory used by MATLAB: 30035 MB (3.149e+10 bytes)
Physical Memory (RAM): 32473 MB (3.405e+10 bytes)

Thank you all.

Get more memory or content yourself with smaller problems. 32GB isn’t much. i don’t know whether increasing virtual memory will help - you might not run out of memory, but things could get rather slow if repeated paging is needed during linear algebra calculations.

Perhaps a first order solver could help. For instance, SCS. But I believe SCS runs only under CVX 3.0beta, which is riddled with bugs which will never be fixed Some of those bugs evidence themselves in error message. Others of them are more insidious, such as ignoring some constraints. YALMIP provides more solver options than CVX, and without bugs when calling first order solvers.

Also, don’t use crazy input numbers. tol = 1e-40 is horrible. I wouldn’t use smaller than tol = 1e-4. In general, you should try to change units to improve numerical scaling.

Don’t use quiet. That way, you will see the CVX and solver output, and have some idea of the solver’s progress, at least when it reports every iteration (or whatever).