10

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?

SecretAgentMan
  • 1,895
  • 2
  • 13
  • 39

1 Answers1

10

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

RobPratt
  • 32,006
  • 1
  • 44
  • 84