# Error : Invalid operation: {6e+06} ./ {real affine}

hello!
i think that is no problem with my code, but this error is displayed : " Invalid operation: {6e+06} ./ {real affine}"

``````    cvx_begin
variable U(m,n) binary
variables x(n) new_R(m,n) ;
maximise( sum( U ) )
subject to

for i=1:m
for j=1:n
Q-(Delay(m,1)+(alpha./new_R(i,j)))>= Value*(1-U(i,j))  % the error displays here

Emax-(Energy_Pr(m,1)+E_prop)>= Value*(1-U(i,j))
0 <= new_R(i,j) <= R_lb(i,j)
end
end

x(1) = x_start
x(n+1) = x_end
for j=1:n
norm(x(j+1)-x(j))= Vmax.taux
end
0 <= x_start <= 1000
0 <= x_end   <= 1000

cvx_end``````

Your program violates CVX’s DCP rules. Use `inv_pos`.

``````     inv_pos(Q-(Delay(m,1)+(alpha./new_R(i,j))))>= Value.*(1-U(i,j))
inv_pos(Emax-(Energy_Pr(m,1)+E_prop))>= Value*(1-U(i,j))``````

Did you read the Users’ Guide entry for `inv_pos`, or better yet the help?

help inv_pos

inv_pos Reciprocal of a positive quantity.
inv_pos(X) returns 1./X if X is positive, and +Inf otherwise.
X must be real.

`````` For matrices and N-D arrays, the function is applied to each element.

Disciplined convex programming information:
inv_pos is convex and nonincreasing; therefore, when used in CVX
specifications, its argument must be concave (or affine).
``````

Correct use of `inv_pos` presumes `new_R `is elementwise nonnegative. if it is not, the problem is not convex.

I recommend you read the entire CVX Users’ Guide carefully, and try some problems in there.

Hi @Mark_L_Stone ! when i have matrices in both left and right hand sides in constraint, should they have the same dimension?

Yes, they should. . .

Thank you for your reply, another question please, is the cvx takes too much time to solve problem, because i have ran my code an hour ago until now it does not finish, knowning that i used a large matrix and when i do pause, I notice that other files are appearing like: inv_pos,pow_cvx,geo_mean_cone,eq,cvx_classify,cvx_vexity. What does mean?

I don’t know. . …