10
$\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$
1
  • $\begingroup$ A nice topic on big $M$ formulation could be found here. $\endgroup$
    – A.Omidi
    Nov 12, 2019 at 5:37

1 Answer 1

10
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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