Hi,

I have to use the following inequality of a SDP problem formulation in CVXPY:

Q_k is a given matrix of size (N, N) with each entry being a complex value; {W_k} is the optimization variable, \gamma_k, P_n are given constant values.I used the following lines of code to write it in python using cvxpy:

def generate_h1(N_t):

# Generate h_1 as a N_t x 1 complex Gaussian vector

h_1 = np.sqrt(1/2)*np.random.randn(N_t, 1) + 1j * np.sqrt(1/2)*np.random.randn(N_t, 1)

return h_1

for k in range(K):

h_k = generate_h1(N_t)

h.append(h_k)

Q = [h_k * h_k.T.conj() for h_k in h]

Gamma = np.logspace(2, 20, K)

W = [cp.Variable((N_t,N_t), symmetric=True) for k in range(K)] # W_k

for k in range(K):

constraints.append(cp.trace(Q[k] @ W[k]) - np.real(Gamma[k])*cp.sum([cp.trace(Q[k] @ W[i]) for i in range(K) if i != k]) >= np.real(Gamma[k]) * P_n)

constraints.append(cp.sum([cp.trace(W[k]) for k in range(K)]) <= P_t)

the code gives the following error: ValueError: Inequality constraints cannot be complex. Could you please suggest a solution to this error?