Invalid quadratic form: must be a scalar

Dear Forum users,

I have the following optimization problem that I couldn’t make it to work for CVX. I would greatly appreciate it if anyone can help.

n=10;
p=100;
g=rand(n,1);
X=randn(p,n);
R=X’*X;

cvx_begin
variable b(n,1);
maximize (g’(eye(n)-bb’)‘R(eye(n)-b*b’)*g)
subject to
norm(b)==1;
cvx_end


Griffin.

I did read that post before I posted mine. I am new to convex optimization. The post doesn’t help. I have already spent 4 days trying to figure out what’s wrong. I tried the sum_square function which is mentioned in your previous post. However, it still doesn’t work. Any ideas will be appreciated.

The problem is that your model is not convex. Neither your objective nor your constraint is convex. CVX is not your tool.

Thank you for your reply.

You’re welcome.

But now I’d like to ask: when you read the question in the FAQ, “Is your model convex?”, what was your answer?

You say that you read the FAQ. But the way you attempted to use CVX suggests to me that you did not actually follow its instructions. After all, your model is not convex! So if you had correctly answered “no, my model is not convex”, then you should have immediately stopped wasting your time trying to use CVX. If your answer was “I’m not sure my model is convex”—again, the FAQ instructs you not to use CVX.

The last thing I want is for people to spend four days trying in vain to get CVX to work for them. I’m trying to be as clear as possible in the documentation and the FAQ about this—heck even the name of the software is taken from the term “convex”.

And yet, if you look at this forum, a large fraction of people asking for help here on this forum are trying to solve models that CVX will never be able to handle. It is a waste of their time, and mine. I want to save us all some trouble.

So if you have suggestions about how I can improve the FAQ or other documentation, so that it is more clear that convexity is essential to the use of CVX, please let me know.

1 Like