How to deal with Cannot perform the operation: {convex} .* {real affine}


(Jinzhao Feng) #1

cvx_begin
variables A(m,n) E(m,n)
variable miu nonnegative
minimize(norm_nuc(A)+lamda*norm(E,1)+(square_pos(norm(A,‘fro’))+square_pos(norm(E,‘fro’)))0.5miu)
subject to
D == A+E;
miu >= 0;
cvx_end


(Mark L. Stone) #2

Multiply symbols* got lost in the forum formatting (please highlight and click on preformatted text for code).

Is this what you were trying to enter

cvx_begin
variables A(m,n) E(m,n)
variable miu nonnegative
minimize(norm_nuc(A)+lamda*norm(E,1)+(square_pos(norm(A,'fro')))+square_pos(norm(E,'fro'))*0.5*miu)
subject to
D == A+E;
miu >= 0;
cvx_end

Even if that is not quite right, it appears you are trying to multiply the CVX variable miu by a (comvex) expression. That is not allowed in CVX, and is non-convex. If you fix miu to a numerical value as a MATLAB variable, rather than declaring it as a CVX variable, then CVX will accept the problem.

Also note that although I don’t think it causes any harm, your declaration of miu as being nonnegative and the constraint miu >= 0 are redundant. You can either omit “nonnegative” in declaration for miu, or not include the constraint miu >= 0. However, that is moot in your case, because making it a CVX variable will result in a (non-convex) problem which CVX will not accept.