-1
$\begingroup$

I have variables $a,b\in\mathbb R$ and if $a>1$ I want $b=1$ or else $b=0$. Can this be encoded by linear programming (no integer variables)? Even $b<0.5$ and $b>0.5$ is ok.

$\endgroup$
5
  • $\begingroup$ This may give some idea. $\endgroup$ Commented Apr 11, 2018 at 5:50
  • 2
    $\begingroup$ LP feasible region is convex. Your region for $a,b \in R$ is not. Maybe you are looking for Integer Programming formulation? $\endgroup$
    – Eugene
    Commented Apr 11, 2018 at 17:36
  • $\begingroup$ @Eugene can you explain why? $\endgroup$
    – Turbo
    Commented Apr 11, 2018 at 22:51
  • 1
    $\begingroup$ You changed the question to a different one, in a way that invalidates the existing answer. That's not very polite to the person who took the time to write an answer to the original question. $\endgroup$
    – D.W.
    Commented Apr 11, 2018 at 23:28
  • $\begingroup$ @d.w. ok I will change. $\endgroup$
    – Turbo
    Commented Apr 12, 2018 at 0:19

1 Answer 1

0
$\begingroup$

The if then contraints can be written equivalently as

  • If $b = 0$, then $a < 1$; and
  • If $b = 1$, then $a \geq 1$.

Introduce a large number $M$ and add the following constraints:

$$b(M+1)-M \le a < b(M+1)+1.$$

EDIT: I assumed that $b$ is binary. If $a$ is bounded $a\in[L,U)$, we can write the constraints as:

$$b(-L+1)+L \le a < b(U-1)+1.$$

$\endgroup$
3
  • $\begingroup$ how large should M be? also this takes $b\in\mathbb Z$. $\endgroup$
    – Turbo
    Commented Apr 11, 2018 at 16:33
  • $\begingroup$ I assumed that $b$ is binary. For $M$, it depends on $a$. See my edits. $\endgroup$
    – zdm
    Commented Apr 11, 2018 at 17:03
  • $\begingroup$ there is an issue i think $a>1$ not $a\geq1$. What if $b=0\iff a\in[0,1]$ and $b=1\iff a>1$? $\endgroup$
    – Turbo
    Commented Apr 11, 2018 at 17:19

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.