I have a binary variable $b\in\{0,1\}$ and three real variables $x,y,z$.

If $b=0$ then I want $x=y$ and if $b=1$ then I want $x=z$.

  1. Is this possible with mixed linear integer programming?

  2. Is this possible at least with mixed integer programming with convex constraints and objective?

  • $\begingroup$ 1. yes; 2. you do not need nonlinear constraints $\endgroup$ – LinAlg Feb 16 at 22:37
  • $\begingroup$ @LinAlg What is the program? $\endgroup$ – T.... Feb 16 at 22:38

You need just 4 constraints and a sufficiently large constant $M$: $$x \geq y - bM$$ $$x \leq y + bM$$ $$x \geq z - (1-b)M$$ $$x \leq z + (1-b)M$$

  • $\begingroup$ Well can we avoid $M$? $\endgroup$ – T.... Feb 16 at 22:42
  • $\begingroup$ @Brout maybe your solver supports indicator constraints. Otherwise you cannot without introducing something worse. $\endgroup$ – LinAlg Feb 16 at 22:43
  • $\begingroup$ 'something worse' could it be in convex mixed integer programming? $\endgroup$ – T.... Feb 16 at 22:43
  • $\begingroup$ @Brout my solution is convex and uses integers; there is just no magic trick to work around big-M $\endgroup$ – LinAlg Feb 16 at 22:58

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.