# How can I formulate this problem in CVX?

Let, P_{t,u},\text{ }t=1,2,\cdots,T\text{ and }u=1,2,\cdots, U

We want to maximize z subject to
\begin{align}
\left(\sum_{t\in T} P_{t,u} (1-x_{t,u})+\sigma\right) z &\le \sum_{t\in T} P_{t,u} x_{t,u} && \text{for all u} \
1 \le \sum_{t\in T} x_{t,u} &\le 5 && \text{for all u} \
x_{t,u} &= 1 && \text{for all t,u such that P_{t,u} \ge \alpha}\
x_{t’,u} &= 0 && \text{for all t,u such that P_{t,u} \ge \alpha and t'\not= t} \
x_{t,u} &\in{0,1} && \text{for all t,u}
\end{align}

by introducing variables y_{t,u}=z*x_{t,u}, \hspace{2mm}t=1,2,\cdots,T,\text{ and } u=1,2,\cdots, U, we can express in CVX as

  T=16;
U=300;

a = .1;
b = 1;
P = (b-a).*rand(T,U) + a;
sigma=0.0001;

M=min(sum(P,1));

cvx_solver Mosek

cvx_begin

variable X(T,U) binary
variable Y(T,U)
variable z

maximize z

subject to

sum(P.*(z-Y))+z*sigma <= sum(P.*X,1)
sum(X,1)<=5;
sum(X,1)>=1;

sum(sum(X,1))<=50;

Y<=XM;
Y>=z-(1-X)M;

cvx_end


The current formulation is giving infeasible solution, why?

Also, how can I express the other constraint?
if P_{t,u}\ge\alpha, then x_{t,u}=1 and x_{t',u}=0,\forall t'\neq t

All but section 1 of https://yalmip.github.io/debugginginfeasible/ also applies to CVX.