0
$\begingroup$

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?

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

1 Answer 1

1
$\begingroup$

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}).$$

$\endgroup$
2
  • $\begingroup$ Thanks and this sole constraint ensures that $f$ is one if one or both conditions hold but is always zero if neiter holds? $\endgroup$ Commented Apr 6, 2024 at 17:29
  • $\begingroup$ No, it enforces that if $f=1$ then either $x=0$ or $z=0$. $\endgroup$ Commented Apr 6, 2024 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.