MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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|cite|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.

up vote 1 down vote accepted


$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|cite|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.