CVX status is solved but constraints aren't meet

I have a problem like this (tow12, tow22 , tow21 ,tow 11, sig21, sig22 ,t3 and t4 are scalar constant and G matrices are also constant )

             cvx_begin

                    cvx_quiet(true)

                    variable Z3(N-2,N-2)  complex hermitian;

                    variable zeta3

                    maximize real(trace(G31*Z3));
                     subject to

                    real( trace(G3*Z3) )<= zeta3*PR; 
                    real( trace ( (G32-t3*G5)*Z3 ) ) == zeta3 *t3 *sig21;
                    real( trace(G4*Z3) ) + zeta3*sig22 == 1;
                    real( trace(G12*Z3)-  (trace(G11*Z3)/t4)  ) <= (tow12-tow11);
                    real( (trace(G22*Z3)/t4) - trace(G21*Z3) ) <= (tow22-tow21);

                    real(trace(G5*Z3)) + zeta3*sig21 == t4

                    zeta3 >= 0

                    Z3 == hermitian_semidefinite(N-2);

cvx_end

After solving the problem The cvx_status is solved but the equality constraints aren’t satisfied I mean for example after run the cvx when I put constraint 2 in command window I get 0. I don’t know why ?

You mean you’re just evaluating

real( trace ( (G32-t3*G5)*Z3 ) ) == zeta3 *t3 *sig21

after CVX is complete? Then of course the answer will be zero. This is a numerical solver, and you must expect that the solutions will be approximate. The likelihood that equality constraints are satisfied exactly is pretty much nil. You must take this fact into account when using the solutions in the rest of your application.

1 Like

So if I remove the equality constraints the result is the same as when there are equality constraints ?

In my problem it is important that equality constraints are satisfied. what can I do to make them satisfied ?

I am afraid you’re simply missing the reality of numerical solvers. Fire up MATLAB, and try this.

A = randn(10,10)
b = randn(10,1)
x = A \ b
A * x == b

In exact arithmetic, you would get all ones in that last computation. In practice, you never will. That does not mean the solver failed, though. It simply cannot guarantee an exact solution, though it will be quite close.