I have a known matrix, S of size N_U\times N_B. For each row, the elements are sorted in ascending order.

I have also defined a binary variable X of size N_U\times N_B.

I want to formulate a constraint such that if the first element in each row is greater than some threshold t_{thrsld}, then the corresponding element in matrix X will be zero.

for u=1,2,\cdots,N_U

IF S_{u,1}\ge t_{thrsld} THEN X_{u,1}==1

end

Note that, I have another constraint in the system as

\sum_{b=1\cdots N_{B}}X_{u,b}=1,\forall u, u=1,2,\cdots, N_U.

S is not a CVX variable or expression. So the if-then logic is a pure MATLAB problem.

I think

`X(S(:,1) >= t_threshold) == 1`

should work, and is the vectorized (fastest executing) way of doing it. But you could instead use a brute force method with for loop and if statements if you wanted.

If you’re not familiar with this construct from “regular” (i.e., non-CVX) MATLAB, you would benefit from some refresher study on MATLAB. The same construct works in CVX.

I removed the MIDCP categorization from the problem because MIDCP is not necessary to model the portion of the problem you have specified.