Suppose we have a binary variable $x$ and a negative continuous variable $y$. How can we linearize the product $u=xy$?
2 Answers
$\begingroup$
$\endgroup$
2
replace the constraint with the followings where $M$ is a large number:
$u \le(1-x)M +y$
$u \ge(1-x)M +y$
$u \le xM$
$u \ge -xM$
-
$\begingroup$ thanks a lot, I think the third and fourth constraints are not correct for example for x=1 & y=-5 we can't get u=-5. $\endgroup$– m.aminCommented Oct 30, 2023 at 7:26
-
1$\begingroup$ Thanks for noticing that. I edited the answer. $\endgroup$ Commented Oct 30, 2023 at 15:24