# Conditional binary programming

I am currently trying to model the relationship that if the binary variables $$b_{it}=0$$ and $$c_{it}=1$$, and for the integer non-negative variable $$b^{n}_{i(t-1)}=0$$, then the new binary variable $$a_{it}$$ is equal to 1, in all other cases 0. I came up with the following constraints, but I think they are wrong.

\begin{align} &a_{it} \leq 1 - b^{n}_{i(t-1)}&&\forall i\in I, t\in \{2,...,T\}\\ &a_{it} \leq 1 - b_{it}&&\forall i\in I, t\in \{2,...,T\}\\ &a_{it} \leq c_{it}&&\forall i\in I, t\in \{2,...,T\}\\ &a_{it} \geq c_{it} + b_{it} + b^{n}_{i(t-1)} - 2&&\forall i\in I, t\in \{2,...,T\} \end{align}

For all four possible combinations, if $$b^{n}_{i(t-1)}=0$$, the coding works. But if, for example, $$b^{n}_{i(t-1)}=2$$, then the construct falls apart with constraint 1. How should I model it instead?

• Is $b^n_{i(t-1)}$ nonnegative or unrestricted in sign?
– prubin
Commented May 15 at 16:24
• I updated my post. Commented May 15 at 17:45

Suppose $$0 \le b^n_{it} \le M^n_{it}$$ for some constant $$M^n_{it}$$. Introduce binary decision variable $$y_{it}$$ to indicate whether $$b^n_{it} > 0$$. Now impose linear constraints \begin{align} y_{it} \le b^n_{it} &\le M^n_{it} y_{it} \\ a_{it} &\le 1 - b_{it} \\ a_{it} &\le c_{it} \\ a_{it} &\le 1 - y_{i,t-1} \\ a_{it} &\ge (1 - b_{it}) + c_{it} + (1 - y_{i,t-1}) - 2 \end{align} The first constraint linearizes $$y_{it} \iff b^n_{it}>0$$. The last four constraints linearize $$a_{it} \iff (\lnot b_{it} \land c_{it} \land \lnot y_{i,t-1})$$.
• Thank you very much. I dont know if i am stupid or its to late in germany, but i cant reproduce my case. Assuming $c_{it}=1$, $b_{it}=0$ and $b^n_{it}=0$ too. The first constraint yields $y_{it}=0$, the second one $a_{it}\leq 1$, the third $a_{it}\leq 1$, the fourth $a_{it}\leq 0$ and the fifth $a_{it} \geq (1-0)+1+0-2 =0$. From my understanding, this yields $a_{it}=0$, however i want it to be equal to 1, or am i wrong? Commented May 15 at 19:53
• @mingabua It was my error. I should have had $1-y$ instead of $y$ in the last two constraints, corrected now. Commented May 15 at 20:15