How to express this constraint in CVX using matrix?

(Dipak Narayanan) #1

Let’s say {\bf A}^{M\times N} and {\bf F}^{M\times N} are two matrices. a_{m,n} and f_{m,n} are the (m,n)-th element of {\bf A} and {\bf F}, respectively.

\begin{align} f_{m,n} & \le a_{m,n}\\ f_{m,n} & \ge 0.2\sum_{l=1}^M f_{l,n} - (1-a_{m,n}) \end{align}

The first constraint I can easily express as

 variable A(M,N) binary
 variable F(M,N)
 F<= A

How can I express the second constraint?

Hint:
F>= 0.2.*?? -(1-A)

Or in a loop?

(Mark L. Stone) #2

F >= 0.2*repmat(sum(F,1),M,1) - (1-A)

Note that using ,1 with sum might seem redundant, but is not in the event that M were ever equal to 1, in which case if it were excluded, MATLAB would sum across the row, not across the one column.