Disciplined convex programming error: Invalid constraint: {convex} <= {convex}


(zy) #1

I am new to CVX and i tried the following optimization problem:
I cut out most of the code to keep only the wrong part. I wrote the formula in the picture
error
%% ---------------------------------------------------------------------
cvx_begin
variable rou(K,K)
variable V(M,1)
variable cauy(M,K)
sb2_left = cvx(zeros(M,1));
sb2_right = cvx(zeros(M,1));

%% -----------------------------calculate subect 2 left
for m=1:M
sb2_left(m) = sum(Gamma(m,: ) .* (cauy(m,:).^2));
end
%% -----------------------------calculate subect 2 right
for m=1:M
sb2_right(m) = V(m)^2;
end
%% -----------------------------subject------------------------------
subject to
for m=1:M
sb2_left(m) <= sb2_right(m);
end
for m=1:M
0 <= V(m) <=1;
end
cvx_end
i got the following error message for line 20 in my code, sb2_left(m) <= sb2_right(m) ;:
Disciplined convex programming error: Invalid constraint: {convex} <= {convex}
What’s wrong?
can anyone help me with this problem?


(Michael C. Grant) #2

This is addressed in the FAQ.


(zy) #3

Thanks for your reply. I read the FAQ based on your suggestion, I think my constraint is not in line with the DCP ruleset. This problem has been proved to be quasi-convex, so to solve some of the feasibility issues. My purpose is to reproduce the original author’s results, how can I modify the constraint expression, can you give me some advice?


(S.Elsalam) #4

I have the same problem. Did you find a solution for it ?


(Mark L. Stone) #5

@S.Elsalam If you show your complete reproducible code, perhaps someone can offer advice. But before doing that, please read Why isn’t CVX accepting my model? READ THIS FIRST! and the CVX User’s Guide http://cvxr.com/cvx/doc/


(S.Elsalam) #6

thank you so much. I will read it.


(S.Elsalam) #7

I have read it but I don’t find a solution for the problem I have.
subject to
for iUserIndex = 1 : NumberOfUsers
zeros(1 , NumberOfAPs) <= Mu_New <= ones(1 , NumberOfAPs);
New_Eita >= zeros(NumberOfUsers , NumberOfAPs);
sum(New_Eita.^2 .* ALL_Users_Gamma_k) <= Mu_New.^2;
end
Matlab gives me this error
Error using cvxprob/newcnstr (line 192)
Disciplined convex programming error:
Invalid constraint: {convex} <= {convex}

Actually, this is not my optimization problem. I am just trying to implement the same problem that mentioned above and I got the same error !!


(Mark L. Stone) #8

If Mu_New. only appears as shown (and not otherwise in non-squared form), then you can use something along the lines of (this may not be quite right, because you don’t seem to have paid much attention to the indexing, and in any event have not shown us your complete code, including variable declarations):

variable Mu_new_squared(NumberOfAPs)
0 <=  Mu_new_squared <= 1
 ...
sum(New_Eita.^2 .* ALL_Users_Gamma_k) <= Mu_New_squared

Otherwise, the problem is non-convex if Mu_New is a CVX variable.


(S.Elsalam) #9

unfortunately, it appears in non-squared form in other constraints.
sorry for bothering you but I have just started working on optimization and I have one more question that may helps. if its is a slack variable the definition will be changed or it will be the same as other variables ?!.


(Mark L. Stone) #10

if its is a slack variable the definition will be changed or it will be the same as other variables ?!.

Is what definition changed? A slack variable is declared the same as any other variable. You can include the nonnegative keyword as part of the declaration, or add a constraint to constrain it to be nonnegative.

variable s nonnegative % slack variable


(S.Elsalam) #11

ok, I have already added a constraint for it to be positive
is there any other way to write this constraint to solve this problem or not !!


(Mark L. Stone) #12

If the variable in question can not be handled only in squared form, then the problem is non-convex, and CVX will not accept it. Please re-read Why isn't CVX accepting my model? READ THIS FIRST! .