# The nonlinear constraints are not satisfied,help CVX!

Let me reformulate my question

``````su=0;
cvx_begin
variable W_cvx(para.Nt,para.Nt,para.kc+para.ks) hermitian
variables miu4 miu3
variables etar zr vr vrp xr yr rrx rrv obj

Wall=zeros(para.Nt,para.Nt);
minimize(0)
subject to
for j=1:para.kc+para.ks
su=su+trace(W_cvx(:,:,j));
W_cvx(:,:,j) == hermitian_semidefinite(para.Nt);
Wall=Wall+W_cvx(:,:,j);
end
su<=para.pmax;

%%communication qos constraint
real( trace(Wall*Us(:,:,i))) >=(2^8-1)*real( trace( ( sum(W_cvx,3)-W_cvx(:,:,para.kc+1)) *Us(:,:,i)) +sigma_s);
for j=1:para.kc
real( trace(Wall*Uc(:,:,j,i)))>=(2^para.gama_c-1)*(real( trace( (Wall-W_cvx(:,:,j)) *Uc(:,:,j,i)))+sigma_c);
end

real( trace( Gur(:,:,i)'*Theta_t(:,:,i)'*te*te'*Theta_t(:,:,i)*Gur(:,:,i)*...
sum(W_cvx,3) )  )<= exp(z0(i,1))*(zr-z0(i,1)) -sigma_e;%C1

real(  trace( Gur(:,:,i)'*Theta_t(:,:,i)'*te*te'*Theta_t(:,:,i)*Gur(:,:,i)*...
(sum(W_cvx,3)-W_cvx(:,:,para.kc+para.ks)) )  )-exp(vr)+sigma_e >=0;%C2

real( trace( Gur(:,:,i)'*Theta_t(:,:,i)'*hrs*hrs'*Theta_t(:,:,i)*Gur(:,:,i)*...
sum(W_cvx,3) )  )- exp(xr)+sigma_s>=0;%C3
real(  trace( Gur(:,:,i)'*Theta_t(:,:,i)'*hrs*hrs'*Theta_t(:,:,i)*Gur(:,:,i)*...
(sum(W_cvx,3)-W_cvx(:,:,para.kc+para.ks)) )  )>=exp(y0(i,1))*(yr-y0(i,1))-sigma_s;   %C4

cvx_end
``````

output:
real( trace( Gur(:,:,i)'*Theta_t(:,:,i)‘tete’Theta_t(:,:,i)Gur(:,:,i)
sum(W_cvx,3) ) )<= exp(z0(i,1))
(zr-z0(i,1)) -sigma_e %C1
ans =
logical
1
real( trace( Gur(:,:,i)’*Theta_t(:,:,i)‘tete’*Theta_t(:,:,i)Gur(:,:,i)
(sum(W_cvx,3)-W_cvx(:,:,para.kc+para.ks)) ) )-exp(vr)+sigma_e >=0 %C2
ans =
logical
0

Wall, zr, vr, xr,yr,rrx and rrv are variables,I did not put any restrictions on vr, xr,rrx,rrv,except for C2, C3. But the constraint C2 and C3 cannot be satisfied,C1 and c4 can, and I think that’s because the constraints are linear with respect to the variables coming in.
As you can see, I didn’t put any restrictions on vr and xr, except for C2, C3. we simply satisfied the constraints with equality. So I think it’s the strict function usage restrictions in cvx, but I can’t find a solution, what’s the problem?

I doubt anyone can figure that out based on the limited information provided.

For instance how violated are constraints?

I suggest you post:

• Log output from the optimizer.
• Complete code and data.

Thanks! I’ve reformulated my question.

As @Erling was hinting at, constraints are considered to be satisfied provided they are “violated” by no more than a feasibility tolerance (perhaps as big as 1e-6 for well-scaled problems). Your “test” makes no allowance for feasibility tolerance. Moreover, if CVX reports `Inaccurate/Solved`, perhaps constraint violations could be larger.

Expressions, such as `Wall`, which despite your claim is an expression, not a variable, are not necessarily populated with their optimal values after `cvx_end`. So you have to calculate their optimal values after `cvx_end` starting from the optimal values of (CVX) variables. That affects some of your constraints. I haven’t checked carefully to see whether that affects the constraints you say are violated. Therefore, any constraint which has one or more expressions, could appear to be violated by more than feasibility tolerance, even if it is actually satisfied (unless you do the recalculation after `cvx_end`).

I actually tried to replace exp with exponential as follows

``````          real( trace( Gur(:,:,i)'*Theta_t(:,:,i)'*te*te'*Theta_t(:,:,i)*Gur(:,:,i)*...
sum(W_cvx,3) )  )<= exp(z0(i,1))*(zr-z0(i,1)) -sigma_e;
{vr,1,rrv}==exponential(1);
real(  trace( Gur(:,:,i)'*Theta_t(:,:,i)'*te*te'*Theta_t(:,:,i)*Gur(:,:,i)*...
(sum(W_cvx,3)-W_cvx(:,:,para.kc+para.ks)) )  )-rrv+sigma_e >=0;
{xr,1,rrx}==exponential(1);
real( trace( Gur(:,:,i)'*Theta_t(:,:,i)'*hrs*hrs'*Theta_t(:,:,i)*Gur(:,:,i)*...
sum(W_cvx,3) )  )- rrx+sigma_s>=0;
real(  trace( Gur(:,:,i)'*Theta_t(:,:,i)'*hrs*hrs'*Theta_t(:,:,i)*Gur(:,:,i)*...
(sum(W_cvx,3)-W_cvx(:,:,para.kc+para.ks)) )  )>=exp(y0(i,1))*(yr-y0(i,1))-sigma_s;
output:
Status: Infeasible
Optimal value (cvx_optval): +Inf
``````

But in most cases it is infeasible,so can I assume it’s because function is different?

`{vr,1,rrv}==exponential(1);`
is the same as
`exp(vr) <= rrv`

`{xr,1,rrx}==exponential(1)`
is the same as
`exp(xr) <= rrx`