 # Cannot perform the operation: {concave} ./ {real affine}

I want to solve a simple convex problem that minimizes the power of transmitting devices. I have a supposed that there are 10 devices each communicating with another device. But, when I run the program it gives me this error:

Error using .* (line 173)
Disciplined convex programming error:
Cannot perform the operation: {concave} ./ {real affine}
Error in ./ (line 19)
z = times( x, y, ‘./’ );
Error in testcode4 (line 36)
Rate(i,j) = W*(log(1+(p(i)((distance(i,j)).^(-pathloss)))./log(2))./((NSDW)+I_D(i,j)));

How can I convert the denominator term in the Rate expression, so that the Rate expression can be solved?

``````distance = rand(10,10);
Rate_min = ones(10,10);
Power_total = 10;
W = 1;
NSD = 1;
pathloss = 1;

cvx_begin
variable p(10,1) nonnegative
minimize norm(p)
subject to
for i = 1:10
for j = 1:10
I_D(i,j) = (p(j))*((distance(i,j)).^(-pathloss));
Rate(i,j) = W*(log(1+(p(i)*((distance(i,j)).^(-pathloss)))./log(2))./((NSD*W)+I_D(i,j)));
end
end
sum(p) <= Power_total;
cvx_end``````

As per one of the suggestions I gave you at Conversion to double from cvx is not possible , remove all instances of `Rate` and instead use
`log(1+(p(i)*((distance(i,j)).^(-pathloss)))) >= Rate_min(i,j)`
except that now that you have a denominator term on the left-hand side, move it to the right-hand side (as a multiplicative term), where it will be affine, and therefore accepted by CVX (you can put log(2) where you want).

Or you can change Rate(i,j) to not include the denominator, and proceed in the obvious manner based on the above to include the denominator term as a multiplicative term in the right-hand side of the inequality.

1 Like

Thank you so very much.

Hi,
I have a kind of similar problem to solve with the constraint here being my objective function. Please advice me if there is a way to solve it in CVX. Its given the same error’'can not perform concave /affine.
max w.r.t p log(A+Bx)/(x+C), where all A,B,C are positive constants.
such that 0<x<1000,

No. The convexity status depends on the values of the constants.

For example, at A = B = C = x = 1, the 2nd derivative is negative. But at A =2, B = C = x = 1, the 2nd derivative is positive.

Please read Why isn't CVX accepting my model? READ THIS FIRST! . You shouldn’t rely on forum readers to do your basic homework of verifying the convexity of your problem before asking for assistance in how to enter it into CVX.