DCP convex programming error: Only scalar quadratic forms can be specified in CVX


Im trying to solve problems using CVX.
But I got the error, “Disciplined convex programming error:Only scalar quadratic forms can be specified in CVX”.
My code is

variables X(4,9) U(1,9)
for i=0:100 

Anyone please help.

(Mark L. Stone) #2

The error is in the line

This is in violation of CXV’s DCP rules Why isn’t CVX accepting my model? READ THIS FIRST! . DCP rules do not allow this because it may be non-convex.

I don’t know what you are really trying to do, and whether that is convex. Therefore, I don’t know whether it can be written in a form which CVX will accept… Nevertheless, I will mark is as non-convex until such time as you show a convex model formulation.

Your code has some strange things, including:

The objective function evaluates to s scalar (it does not involve any CVX variables o expressions); therefore, your problem in effect has no objective function, i.e., is a feasibility problem.

The constraints inside the for loop do not involve the for loop index, i, . Therefore, the exact same constraints are repeated each time through the loop, i.e., 101 times. Obviously, this is not what you want to do.

diag(1,0) is the same as the scalar 1.


Thanks so much for an respond.
I recognized I have not understood CVX.
I read CXV’s DCP rules.as you say,
is non-convex.

The problem I am trying to reproduce is the example of a relatively optimal control(https://ieeexplore.ieee.org/document/4177469).
This is convex optimization, so I think this problem can solved using CVX.(but I couldn’t…)
In this problem, should I use other methods insted of CVX?

(Mark L. Stone) #4

I think you will need to extract the model out of that paper, to which I do not have access.

Per Why isn’t CVX accepting my model? READ THIS FIRST! , your first obligation is to formulate a convex optimization problem and show that it is convex. Citing a convexity claim in a paper is not sufficient, because you may either be losing critical context, or the paer’s claim cold be wrong - that happens a lot.

If it is convex, it may or may not be possible to enter or reformulate for entry into CVX. If you present the model and convexirty proof, readers on this forum can attempt to assist you in (re)formulating it for entry into CVX.

Have you studied convex optimization, or any optimization? If not, you are better off spending time and effort reading and solving exercises in a book such as “Convex Optimization”, Boyd and Vandenberghe http://web.stanford.edu/~boyd/cvxbook/ rather than starting off trying to implement a model in a journal article.


I truly appreciate your quick reply.
The problem is here.

(Mark L. Stone) #6

If that is convex, it is not obvious to me. Does the paper show how this model is optimized using CVX, or any other convex optimization tool or solver?

Not only do constraints (23) and (24) not look convex, neither does the objective function (18), due to the product terms in the integral formula which defines W.

I recommend you follow the advice in the last paragraph of my previous reply.