Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

Hi all. Let $a$ and $b$ be two real variables such that $0 \le a \le a_{max}$ and $0 \le b \le b_{max}$. I must write the following if-then-else condition with linear inequalities:

if $a < a_{max}$ then $b = 0$ else $b \ge 0$.

Is it possible by adding a single binary variable $y$?

share|improve this question

closed as off-topic by Ricardo Andrade, Andrey Rekalo, Lucia, Stefan Kohl, David White Dec 2 '13 at 22:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about research level mathematics within the scope defined in the help center." – Ricardo Andrade, Andrey Rekalo, Lucia, Stefan Kohl, David White
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 0 down vote accepted

Yes.

$a_{\text{max}} y \leq a \leq (1-y)(a_{\text{max}} - \epsilon) + a_{\text{max}}y$

$0 \leq b \leq b_{\text{max}} y$

where $y \in \{{0,1\}}$ and $\epsilon$ is a small positive real.

share|improve this answer
    
$epsilon$ is emulating the "<" condition, right? If I set $epsilon=0$ then I get the $a \le a_{max}$ condition. I'll mark as an answer. –  ashade Aug 14 '12 at 23:51
    
In general, you cannot write strict inequality constraints (< or >) in numerical math programs. The $\epsilon$ is used as an approximation, and is usually set to your solver's numerical tolerance. –  Gilead Aug 15 '12 at 5:30

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