The optimal solution doesn't satisfy constraints

The optimal solution of cvx of my problem doesn’t satisfy the constraints. Sometimes the optimal solution is even NAN. Why does that happen? I really appreciate your help.My optimization problem is

\mathop {\min }\limits_{{\mathbf{w}}_i^q,{\mathbf{R}}_i^q} \sum\limits_{q \in \mathcal{Q}} {{\mathbf{w}}_i^q} + \frac{1}{{4\rho \left| {{\mathcal{N}_i}} \right|}}\left\| {{\mathbf{J}}_i^q + \sum\limits_{m \in \mathcal{C}} {w_{m,i}^q} {{\left( {P_{m,i}^q} \right)}^{ - 1}} - \rho \sum\limits_{j \in {\mathcal{N}_i}} {\left( {{\mathbf{G}}_i^q + {\mathbf{G}}_j^q} \right)} } \right\|_{\text{F}}^2
subject to
\sum\limits_{m \in \mathcal{C}} {\sum\limits_{q \in \mathcal{Q}} {w_{m,i}^q} } \leq 1,0 \leq w_{m,i}^q \leq 1
and

cvx_begin quiet
variable wn(numTargets*numWaveforms,1)
%objective function
sumtemp = 0;
for tt = 1:NT
    Ptn(:,:) = Pn(tt,:,:);
    Jtn(:,:) = J(tt,n,:,:);
    BwR = Jtn - eigd(tt)*I/NS + kron(wn((tt-1)*NW+1:tt*NW),I)'*Ptn;
    Gt(:,:,:) = G(tt,:,:,:);
    Gtn(:,:) = Ni(n)*G(tt,n,:,:);
    Gtn = squeeze(sum(repmat(adjMtx(n,:)',[1 2 2]).*Gt(:,:,:))) + Gtn;
    G(tt,n,:,:) = Gtn; 
    BwR = rau * Gtn - BwR;
    sumtemp = sumtemp + square_pos(norm(BwR,'fro'));
end
sumtemp = sumtemp*(4*rau*Ni(n))^-1;
minimize sum(wn) + sumtemp
subject to

sum(wn)<= 1;
0<= wn(:) <=1;
cvx_end

and the solution provided by cvx is

wn =
-0.332226953019249
-0.748503158782832
-0.748502096685550
-0.748504046328755
-0.748504158952366
-0.748504346237178

Two+ suggestions:

  1. Don’t use the quiet option if you don’t know what’s going on (note: you don’t know what’s going on) . Then you will see what happens with the solver and CVX’s determination of the solution status. You can also try alternative solvers.

  2. Use the Preformatted text option for your code so that colon close parenthesis doesn’t get converted to a smliey face.