Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Consider a problem with three variables: $u$, $\sigma_l$, and $\sigma_w$ where $\sigma_w > \sigma_l$. I want to represent the following relationship using integer programming. \begin{equation} u = \begin{cases} \sigma_w - x & x < \sigma_l \\ 0 & x > \sigma_l \end{cases} \end{equation}

Using simple either-or constraints (with a binary variable and big M) I can get the correct value for the cases where $x > \sigma_w$ and the case where $x < \sigma_l$, however when $x \in (\sigma_l , \sigma_w)$ these either-or constraints fail. To show you what I have tried thus far, I write the either-or constraints I tried:

$0 \leq u \leq Mz\\ \sigma_l - x + z(\sigma_w - \sigma_l) \leq u \leq \sigma_l - x + z(\sigma_w - \sigma_l) + M(1-z)$

where $z \in \{0,1\}$ and $M$ is an arbitarily large number.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

After thinking further, the following either-or constraints do the trick. So, when $x<\sigma_l$, then $z$ must equal one and $u$ is set to $\sigma_w-x$. Otherwise, $z=0$ and $u=0$

$ 0 \leq x - \sigma_l + Mz\\ 0 \leq -u + Mz \\ x - \sigma_l \leq 0 + M(1-z) \\ \sigma_w - x \leq u \leq \sigma_w - x + M(1-z) \\ u \geq 0 \\ $

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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