I have written the following optimization problem(NEO k means with SDP) in cvx(SDP).

\begin{multline}

\max_{Z,f ,g} \ trace(KZ) − f^Td \

subject to \

trace(W^{−1}Z) = k \

Z_{ij} ≥ 0 \

Z = Z^T \

Ze = Wf \

e^Tf = (1 + α)n \

e^T g ≥ (1 − β)n \

f \geq g \

0 \leq g \leq 1

\end{multline}

I have written the following code for the above optimization problem in the cvx matlab.

```
cvx_begin SDP
variables Z(n_datapoints,n_datapoints) f(n_datapoints,1) g(n_datapoints,1)
minimize ((f' * d ) - trace(K * Z))
trace(inv(W) * Z) == k_classes
Z >= 0
Z == Z'
(Z * e) == (W * f)
e' * f == (1+alpha)*n_datapoints
e'* g >= (1-beta)*n_datapoints
f >= g
g>= 0
g <= 1
cvx_end
```

% now use cvx to formulate the problem

cvx_begin SDP

variables Z(n_datapoints,n_datapoints) f(n_datapoints,1) g(n_datapoints,1)

trace( Z/W) == k_classes

Z >= 0

Z == Z’

(Z * e) == (W * f)

e’ * f == (1+alpha)*n_datapoints
e’* g >= (1-beta)*n_datapoints

f >= g

g>= 0

g <= 1

minimize ((f’ * d ) * trace(K * Z))

cvx_end

cvx_status

I don’t know whether I have written it correctly or not. Whenever I am running it , it is giving me out of memory error.

Please help me.