# Convexity and DCP error

``````cvx_begin
variables x_loose(totalbandwidth,num_user) y_loose(timewindow,num_user) ;
variable  z(totalbandwidth,timewindow,num_user);
maximize(sum(sum(sum(z,1),2),3));
subject to
for i=1:num_user
z(:,:,i)<=bandmove(:,:,i)*(x_loose(:,i)*y_loose(:,i)').^(1/2)*timemove(:,:,i);
end
0<=x_loose<=1;
0<=y_loose<=1;
sum(x_loose,1)<=1;
sum(y_loose,1)<=1;
for i=1:num_user
forbiddenbandwidth(:,i)'*x_loose(:,i)==0;
forbiddentime(:,i)'*y_loose(:,i)==0;
end
sum(z,3)<=1;
cvx_end
``````

1.im not really sure about the convexity
2.if it’s convex, how can i deal with that erring constraint?
3.is there any better form of the objective function? it looks redundant

The error is due to the product of variables `x_loose(:,i)` and `y_loose(:,i)`.

This looks non-convex to me. Basically, after reformulating the problem to eliminate `z`, this amounts to a non-convex QP

The 1st constraint would be a Rotated Second Order Cone constraint if rewritten in terms of a new variable `z_sqrt`, defined as the square root of `z`. But then the objective would be the sum over all dimensions of `z_sqrt.^2`, which is convex, and therefore can’t be maximized in CVX.

This could be turned into a convex optimization problem is you changed what is squared. That would not be an equivalent problem. You would have to determine whether or not that different problem would suit your needs.