-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$
  • $\begingroup$ This may give some idea. $\endgroup$ – Sanjay Chandlekar Apr 11 '18 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 Apr 11 '18 at 17:36
  • $\begingroup$ @Eugene can you explain why? $\endgroup$ – T.... Apr 11 '18 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. Apr 11 '18 at 23:28
  • $\begingroup$ @d.w. ok I will change. $\endgroup$ – T.... Apr 12 '18 at 0:19
1
$\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$
  • $\begingroup$ how large should M be? also this takes $b\in\mathbb Z$. $\endgroup$ – T.... Apr 11 '18 at 16:33
  • $\begingroup$ I assumed that $b$ is binary. For $M$, it depends on $a$. See my edits. $\endgroup$ – zdm Apr 11 '18 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$ – T.... Apr 11 '18 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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