Need help in framing the set of linear equations for a binary variable as per following conditions

62 Views Asked by At

I have a binary variable array: $Y(i,j)$. Where $i=1,\dots,I$ and $j=1,\dots,K$. Here $K$ and $I$ need not to be same. In other words, the matrix formed $Y(i,j)$ is not necessarily be a squared ( but it can be).

Let us take an example of $Y$ as follows: $\begin{bmatrix} 1&1&0&0&1&1&0&0&1&0&0&0 \\ 0&0&0&0&1&1&0&0&1&0&0&0 \\ 1&1&0&0&1&1&0&0&0&0&0&0 \end{bmatrix}$.

We can see that $I=3$ and $K=12$. Let us assume that $j=1,2$ are from $group \space A$ and $j=3$ is from $group \space B$

Condition 1: Only $j=1,5,9,\dots$ positions will have either $0$ or $1$. Rest will only have $0$. Except for following condition

Condition 2: If $Y(i,j)$ is $1$ for elements in $group \space A$ and $group \space B$ simultaneously, then $Y(i \in group \space A , group \space B ,j=j+1)$ should also be $1$.

For example:

$Y(1,1)$ and $Y(3,1)$ are $1$. Thus, $Y(1,2)$ and $Y(3,2)$ are also $1$.

Condition 3: If multiple $Y(i,j)$ from same groups are $1$ for same $j$, then Condition 2 does not hold true.

For example,

$Y(1,9)$ and $Y(2,9)$ are $1$. But $Y(1,10)$ and $Y(2,10)$ are NOT $1$.

How to write a set of generic linear equations in terms of :

  • Groups : $Group \space A ,Group \space B, \dots$
  • $i: 1,\dots,I$
  • $j: 1,\dots,K$
1

There are 1 best solutions below

0
On

You can convert logical implications to linear constraints somewhat automatically by using conjunctive normal form. For your first example: $$ (Y(1,1) \land Y(3,1)) \implies (Y(1,2) \land Y(3,2)) \\ \lnot(Y(1,1) \land Y(3,1)) \lor (Y(1,2) \land Y(3,2)) \\ (\lnot Y(1,1) \lor \lnot Y(3,1)) \lor (Y(1,2) \land Y(3,2)) \\ (\lnot Y(1,1) \lor \lnot Y(3,1) \lor Y(1,2)) \land (\lnot Y(1,1) \lor \lnot Y(3,1) \lor Y(3,2)) \\ (1 - Y(1,1) + 1 - Y(3,1) + Y(1,2) \ge 1) \land (1 - Y(1,1) + 1 - Y(3,1) + Y(3,2) \ge 1) \\ (Y(1,1) + Y(3,1) - 1 \le Y(1,2)) \land (Y(1,1) + Y(3,1) - 1 \le Y(3,2)) \\ $$ We have obtained linear constraints \begin{align} Y(1,1) + Y(3,1) - 1 &\le Y(1,2) \tag1 \\ Y(1,1) + Y(3,1) - 1 &\le Y(3,2) \tag2 \\ \end{align} It is easy to check that substituting $Y(1,1) = 1$ and $Y(3,1) = 1$ into $(1)$ and $(2)$ forces $Y(1,2)=1$ and $Y(3,2)=1$, respectively.