7
$\begingroup$

I am looking for the formulation of a constraint that does the following. I want to introduce a new binary variable $\kappa_{it}$ that takes the value 1 if the sum of the other binary variable $\omega_{it}$ is greater than or equal to the number $N_{\max}$ by time $t$. Otherwise, it is to become zero. My suggestion would be:

$$ \sum_{k=1}^{t}\omega_{ik}\le N_{\max} + M \cdot \kappa_{it}\\ N_{\max}+\mu\le\sum_{k=1}^{t}\omega_{ik}+\left( 1-\kappa_{it} \right) \cdot M $$

where $\mu$ is a small value. Is that correct?

$\endgroup$
3
  • $\begingroup$ This looks correct to me. A small suggestion. Since you are dealing with all the binaries, $\mu$ can just be 1. $\endgroup$ Jul 4, 2023 at 11:55
  • $\begingroup$ The text of the question says $\kappa_{it}$ should be 1 if the sum is greater than or equal to $N_{max}.$ The formulation (with $\mu=1$) would be for greater than $N_{max}.$ $\endgroup$
    – prubin
    Jul 4, 2023 at 15:19
  • $\begingroup$ Related $\endgroup$ Oct 5, 2023 at 13:09

1 Answer 1

7
$\begingroup$

You want to enforce $$ \sum_{k=1}^t \omega_{ik} \ge N_{max} \iff \kappa_{it}=1 $$ Or equivalently \begin{align} \left( \kappa_{it}=1 \implies \sum_{k=1}^t \omega_{ik} \ge N_{max} \right) \wedge \left( \kappa_{it}=0 \implies \sum_{k=1}^t \omega_{ik} \le N_{max}-1\right) \end{align}

You can enforce this with big-M constraints: $$ N_{max}\kappa_{it} \le \sum_{k=1}^t \omega_{ik} \le N_{max}-1+(t+1-N_{max})\kappa_{it} $$

$\endgroup$

Your Answer

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

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