DCP error/ Expreesion in objective function must be real

Hey I am trying to solve SDP problem
max tr(AZ)
s.t diag(Z)=1
Z is semidefinite matrix

cvx_begin sdp
 variable Z(n,n); 
 maximize real(trace((phi{m-1}*Z)));
 subject to
     diag(Z)==1;
     Z==semidefinite(n); cvx_end

Without word real in objective function it was giving error -"Expressions in objective functions must be real."
So i made keyword real. But I think i might be loosing some information in complex part.
So I used keyword ‘abs’ instead of ‘real’ but now the error is "Disciplined convex programming error:
Cannot maximize a(n) convex expression"
I am trying to maximize SINR which is my real problem and not atall familiar with optimization. This code snippet is just small part and I need this Z to further formulate. Since I think rest of my MATLAB code is fine. I think I might be loosing some information in this real(trace(A*Z))
Thanks in advance

1 Like

You shouldn’t be getting the real warning unless phi is complex. And if that is complex, in all likelihood, your variable Z should be, too, and you should be using a complex semidefinite constraint. The easiest way to do that is simply to declare

variable Z(n,n) hermitian

and also change the semidefinite constraint to

Z >= 0

Since you are using SDP mode, CVX will automatically convert this to a hermitian_semidefinite constraint.

You are still going to need real in there even if this is the case.

Phi is complex. Does that mean objective function has to be real. Why cant i take absolute value to make it real? that way i can have information from imaginary part as well. By specifying Z to be hermitian final SINR further diverges from correct value.

Further You can see objective funtion with A complex. Is code correct for such statement. As if this part is correct then I can start looking for other parts of my code.

Complex objective functions make no sense. (How do you maximize or minimize a complex value?) As for why you cannot take the absolute value, read the FAQ).