2
$\begingroup$

Suppose we have a binary variable $x$ and a negative continuous variable $y$. How can we linearize the product $u=xy$?

$\endgroup$
1
  • 3
    $\begingroup$ You can define $z=-y$ and use the usual technique described for example here. $\endgroup$
    – Kuifje
    Commented Oct 29, 2023 at 16:32

2 Answers 2

1
$\begingroup$

base on use the usual technique described here and general formula is give here(page 7, section 2.8) we get to this:

\begin{array}{ll} \ u = x.y \\ u\le 0\\ u\ge -Mx\\ u\ge y\\ u\le y+M(1-x) \end{array}

$\endgroup$
1
$\begingroup$

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$

$\endgroup$
2
  • $\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.amin
    Commented Oct 30, 2023 at 7:26
  • 1
    $\begingroup$ Thanks for noticing that. I edited the answer. $\endgroup$ Commented Oct 30, 2023 at 15:24

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.