# Error using cvx/pow_cvx (line 144) Disciplined convex programming error: Illegal operation: pow_p( {convex}, {-1} )

My code is as follows:

``````cvx_begin
variable traj(para.T+1, 2)
variable u(1, para.T)
variable v(1, para.T)
variable t(1, para.T)
expression lower_bound(1, para.T)
expression D(1, para.T)

for ii=1:para.T
lower_bound(ii) = coe3(ii)*u(ii) + coe4(ii)*v(ii);
D(ii)=log2(1+gamma0*pow_abs(A.*inv_pos(t(ii).^(para.kappa_UG/2))+C.*inv_pos(v(ii)),2));
end

maximize(1/para.T*(sum((lower_bound)-D)))

subject to
80 <= u;
40 <= v;
80 <= t;

for jj=1:para.T
pow_pos(norm(traj(jj, :)-para.place_user(1:2)),2)+6400+u0(jj)^2-2*u0(jj)*u(jj)<=0;
pow_pos(norm(traj(jj, :)-para.place_IRS(1:2)),2)+1600+v0(jj)^2-2*v0(jj)*v(jj)<=0;
pow_pos(norm(traj(jj, :)-para.place_eve(1:2)),2)>=0;
end

for ii=1:para.T
pow_pos(norm(traj(ii+1,:)-traj(ii, :)),2)<=para.Vmax^2;
end
cvx_end
``````

Unfortunately, every time I run this code, cvx gives me this type of error:

Error using cvx/pow_cvx (line 144)
Disciplined convex programming error: Illegal operation: pow_p( {convex}, {-1} )

Error in cvx/inv_pos (line 5)
y = pow_cvx( x, -1, ‘pow_p’ );

Error in opt_traj (line 47)
D(ii)=log2(1+gamma0*pow_abs(A.*inv_pos(t(ii).^(para.kappa_UG/2))+C.*inv_pos(v(ii)),2));

Maybe it is written in a manner that violates the CVX rules so that it is rejected. I have read the guide for this kind of Disciplined convex programming error but I’ve no idea how to rewrite the expression for D(ii). Any help from your guys would be appreciated.

You have violated the rules for `pow_p`
help pow_p

pow_p Positive branch of the power function.
pow_p(X,P) computes a convex or concave branch of the power function:
P < 0: pow_p(X,P) = X.^P if X > 0, +Inf otherwise
0 <= P < 1: pow_p(X,P) = X.^P if X >= 0, -Inf otherwise
1 <= P : pow_p(X,P) = X.^P if X >= 0, +Inf otherwise
Both P and X must be real.

``````Disciplined convex programming information:
The geometry of pow_p(X,P) depends on the precise value of P,
which must be a real constant:
P < 0: convex  and nonincreasing; X must be concave.
0 <= P < 1: concave and nondecreasing; X must be concave.
1 <= P    : convex  and nonmonotonic;  X must be affine.
In all cases, X must be real.
``````

That inequality looks like it is going in the wrong direction to be convex. Have you proven the problem is convex? Until then, I will presume the problem is non-convex.

1 Like

Thanks for your help. The objective function of the maximization problem is concave, but its feasible region is non-convex. Thus, the problem is not a convex optimization problem.