Add second "constraint" to model a binary variable

in my model I have the binary variable $$f_{ij}$$ which pushes a time-dependent $$j$$ integer variable $$D_{ij}$$ to zero if $$f_{ij}$$ takes the value 1 and keeps the integer number if $$f_{ij}$$ equals 0. Yes, I have linearised it accordingly. The variable $$f_{ij}$$ is currently coded like this. It takes the value 1 if the additional binary variable $$z_{ij}$$ was always zero in the last $$\alpha$$ days.

\begin{align} &(1-f_{ij})\le\sum_{t=j-\alpha}^{j-1}z_{it}&\quad\forall i\in I, j\in \{1+\alpha,\ldots,J\} \\ &M\cdot (1-f_{ij})\ge \sum_{t=j-\alpha}^{j-1}z_{it}&\quad\forall i\in I, j\in \{1+\alpha,\dots,J\} \end{align}

In addition to zero, I want to introduce that the variable $$f_{ij}$$ can also take the value 1 if the third binary variable $$x_{ij}$$ was zero in each of the last $$\beta$$ days. How can I additionally model this?

• I guess you can write your first constraint around $D$ as: $D_{i,j} = j(1-f_{i,j}) \ \ \ \forall j \in \{\alpha,...J\}$ Apr 7 at 2:20

Your second constraint is an aggregation of $$f_{ij}\le 1-z_{it}$$ for $$t\in\{j-\alpha,\dots,j-1\}$$, which enforces the logical implication $$f_{ij}\implies \lnot z_{it}.$$ To instead enforce $$f_{ij}\implies (\lnot z_{it}\lor \lnot x_{it}),$$ impose $$f_{ij}\le (1-z_{it})+(1-x_{it}).$$
• Thanks and this sole constraint ensures that $f$ is one if one or both conditions hold but is always zero if neiter holds? Apr 6 at 17:29
• No, it enforces that if $f=1$ then either $x=0$ or $z=0$. Apr 6 at 17:35