9
$\begingroup$

I am trying to formulate the following in linear programming. \begin{cases}\text{if}\,\,a>b\,\,\text{then}\,\,c=a\\\text{else}\,\,c=b.\end{cases}

I tried some things with big $M$, like $$a + my > b+m(1-y),$$ so that $y$ (binary) can be used to pick either $a$ or $b$ or $c$.

I know this does not work, because $y$ will always be $1$ in this example. But even with the help of other examples I cannot seem to figure it out. Any tips?

$\endgroup$
  • $\begingroup$ A nice topic on big $M$ formulation could be found here. $\endgroup$ – A.Omidi Nov 12 at 5:37
8
$\begingroup$

Equivalently, $c=\max(a,b)$. See this post.

$\endgroup$

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.