# Error using cvx/times (line 262) Disciplined convex programming error: Invalid quadratic form(s): not a square

``````CH=2l TS=50; NQ=4; number_nodes=9; SPass(1)=2; q=9; qq=9;
cvx_begin
variable act2(CH,TS,NQ+1)
integer variable act3(CH,number_nodes)
integer variable A1
integer variable lambda(TS)
binary variables rk(SPass(1),1) D r y1(q,qq,SPass(1)+1) y2(q,qq,SPass(1)+1)
minimize sum(lambda)
subject to
...
for s=1:TS for f=1:CH for q=1:NQ+1
for i=1:number_nodes
for j=1:number_nodes
sum(sum(y1(i,j,:)+y2(i,j,:)))<=lambda(s).*act2(f,s,q)
end
end
end
end
end
cvx_end
``````

. .

Output:

Error using cvx/times (line 262) Disciplined convex programming error: Invalid quadratic form(s): not a square.

Error in optimsche (line 165) sum(sum(y1(i,j,:)+y2(i,j,:)))<=lambda(s).*act2(f,s,q)

lambda(s).*act2(f,s,q) is indefinite, hence not convex. See FAQ: Why doesn’t CVX accept my problem? [READ THIS FIRST] .

I will leave it to others to determine whether there is a convex and DCP-compliant reformulation for the problem the OP is trying to solve. I presume there may be some constraints not shown, since for instance, A1 is declared, but its use not shown in the code.

thanks for your answer, my problem in not convex but i solv it by cvx_solver mosek,
can it solve the problem? and i don’t write all of code , it’s part of it and A1 used before.

To use cvx_solver mosek, other than integer (or binary) declarations, your problem needs to be convex, and indeed DCP-compliant. Your problem is not, so you can not solve it with any solver using CVX.