How can i solve this problem by CVX?please help me~


cvx_begin sdp
variable M;
variable v;
subject to
Error in cvx/eq (line 12)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘[]’ ), x, y, ‘<=’ );

(Mark L. Stone) #2

What are the dimensions of A and B? Are M and v really scalar variables, as you have defined them. or are they supposed to be vector variables.

In any event, this doesn’t look convex to me unless B is negative semidefinite and A is positive semidefinte…


yes!!!it’s really a non-convex problem as the question described!
After I changed “M’AM<=v’Bv” to “M’AM-v’Bv<=0”,it produce the desired result.
oh~~thank you very much!

(Mark L. Stone) #4

I d’t understand your2nd post. If you are acknowledging that is a non-convex problem, then CVX can not be used to formulate or solve it. If you have changed something to make it convex, please tell us what you did.


actually, I don’t understand how to see whether a function is convex or non-convex.
My teacher had told me that,if A and B are variables,the form like A + B is convex, when AB is non-convex.
So in my understanding, this form like “M’AM<=v’Bv”(where M and v are vector variables,A and B are matrix constant) is convex.but you told me that’s wrong.So i change constrain"M’AM<=v’Bv" to “M’AM-v’Bv<=0”.Amazing!!it worked!Although I don’t know why the problem was solved.
actually,the complete form of my constrain is "M’AM+M
B+C<=v’Dv+vE+F"(where M and v are vector variables,A,B,C,D,E and F are matrix constant) .When i wrote the constrain like "M’AM+MB+C<=vE+F",it’s right.But when i wrote it as"M’AM+MB+C<=v’Dv+v*E+F",it’s wrong.
I don’t know why,and i think both of them are convex.I think I should learn more about how to judge whether a function is convex or concave.:smile:

(Mark L. Stone) #6

There is a difference between a convex function and a convex constraint. if f(x) is a convex function of x, then f(x) <= 0 is a convex constraint, but f(x) >= 0 is not a convex constraint (unless f(x) is also concave, which is only the case if it is affine (linear)).

You need to either study more, consult your teacher, or if you need help online, then ask for it perhaps at . The CVX forum is not meant for tutorial help in introductory convex analysis or convex optimization.

As for why M’ *A* M <= v’ *B* v is rejected by CVX, but M’ *A* M-v’ *B* * v <= 0 is accepted by CVX, I would need o see reproducible code, complete with the values of A and B ir order to understand why, because I don;t believe that should happen - so either there is a bug in CVX or you are not telling us something.


dear stone,you are right.although my code can run,it’s became infeasible later.