1
$\begingroup$

Suppose I have the following set of binary variables:

$X_i$: $I$ ranges from {1,..,4} Highest priority among the three variables $X$ , $Y$ and $Z$

$Y_j$: $J$ ranges from {1,..,3}

$Z_k$: $K$ ranges from {1,2} lowest priority among the three variables $X$ , $Y$ and $Z$

How can I formulate the following :

(1) If any variable $Z_k = 1$ for each $k\in K$, Then each and every $Y_j$ variables $y_1$, $y_2$, $y_3$ must first $=1$

i.e. $y_1 = 1$, $y_2 = 1$, $y_3 = 1$

In other words, before any $Z_k$ for each $k\in K$ $=$ 1, all $Y_j$ variables must FIRST = 1

(2) SAME APPLIES FOR THE RELATIONSHIP BETWEEN $X$ AND $Y$ variables

If any variable $Yj = 1$ for each $j\in J$ Then each and every Xi variable $X1$, $X2$, $X3$, $X4$ must first $=1$

$x1 = 1$, $x2 = 1$, $x3 = 1$ , $x4 = 1$

In other words, before any $Y_j$ for each $j\in J$ variables = 1, all $Yj$ variables must first be = 1

I'll write an example just to make sure I was clear:

Before $y_2$ is picked and is = 1, All $x_i$ for each $i\in I$ must equal to 1. Meaning that X variables are at a higher priority than y variables and should be picked first.

$\endgroup$
2
  • $\begingroup$ Welcome to OR.SE. Is there any difference between $x$ and $X$, and $y$ and $Y$? $\endgroup$ – A.Omidi Dec 1 '20 at 7:47
  • $\begingroup$ No they are both the same, sorry for this mistake. $\endgroup$ – MAHER Dec 1 '20 at 22:59
4
$\begingroup$

When I get your problem correctly you want to enforce every $X_i$ to be activated when any $Y_j$ is activated and every $Y_j$ to be activated when any $Z_k$ is activated.

This can be achieved by adding constraints: $$ \begin{align} X_i &\geq Y_j &\forall i\in I, j\in J\\ Y_j &\geq Z_k &\forall j\in J, k\in K\\ \end{align} $$ Here the first set enforces all $X_i=1$ when any $Y_j=1$ and the second all $Y_j=1$ when any $Z_k=1$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.