3
$\begingroup$

I am having trouble linearizing the following logical constraints.

$x,y,z$ are non negative continuous variables such that $x=y+z$, and $A$ is a positive parameter. I would like to linearize $$ y= \left\{ \begin{array}{ll} x & \mbox{if } x \le A \\ A & \mbox{otherwise} \end{array} \right. $$ and $$ z= \left\{ \begin{array}{ll} 0 & \mbox{if } x \le A \\ x-A & \mbox{otherwise} \end{array} \right. $$

$\endgroup$

1 Answer 1

4
$\begingroup$

Assume $0 \le x \le U$ for some constant $U$. Introduce binary decision variable $\delta$ and impose $x=y+z$ and indicator constraints: \begin{align} \delta=0 &\implies (0 \le x \le A \land y = x) \tag1\label1\\ \delta=1 &\implies (A \le x \le U \land y = A) \tag2\label2 \end{align}

You can linearize \eqref{1} and \eqref{2} as follows: \begin{align} A \delta \le x &\le A(1-\delta)+ U \delta \\ (A - U) \delta \le y - x &\le 0 \\ A \delta \le y &\le A \end{align}


Note that you can express the desired relationship as $y=\min(x,A)$. If you instead wanted to enforce only $y\le\min(x,A)$, you would omit $\delta$ and just impose \begin{align} y &\le x \\ y &\le A \end{align}

$\endgroup$

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