-1

i have this constraint right here, which is not linear. How would i linearize such a product. $number_t$ is a positive integer and $new_t$ and $reset_t$ are binary.

$$number_t = (number_{t-1}+new_t)\cdot (1-reset_t)$$

RobPratt
  • 32,006
  • 1
  • 44
  • 84
Uni ewr
  • 21
  • 2

1 Answers1

0

Some comments already hinted at questions that give you the answer. In your specific example, this translates to the following:

\begin{align} 0 \leq number_t \leq (number_{t−1}+new_t) \newline number_t \geq (number_{t−1}+new_t)-reset_tM \newline number_t \leq M(1−reset_t) \end{align}

If $reset_t = 0$, through the first and second constraint we force $number_t$ to take value $number_{t-1}+new_t$. If $reset_t=1$, through the first and third constraint, we force $number_t$ to be 0. Where $M$ is a large enough number.

PeterD
  • 1,501
  • 4
  • 16
  • Thank you @PeterD. Assuming i also have $number_t = (number_{t-1}+new_t)\cdot (1-reset_t)-c_t + b_t$, which of both are also binary, how would i need to modify the constraints then? Thanks in advance? – Uni ewr Feb 13 '24 at 14:38
  • 1
    Would it work if, for example, I replace $number_t$ with $nr_t$ in your solution and then calculate $number_t=nr_t-c_t+b_t$? – Uni ewr Feb 13 '24 at 15:17
  • @Uniewr yes that would work. – PeterD Feb 13 '24 at 19:29