4

We have decision variables $x\in\{0,1\}$ and $y>0$. We know that $x=1$ if and only if $y\leq D$ and $x=0$ iff $y>D$. $D>0$ is a model parameter.

How I modeled these constraints is \begin{align*} xy&\leq D\\ y&>D(1-x) \end{align*}

But there are two problems, I think. It works well if $x=1$, but when $x=0$, in the first constraint we get $D\geq 0$ is that ok?

Also, the first constraint is nonlinear and we preferably would like to avoid linearization techniques here.

How do I model this?

SecretAgentMan
  • 1,895
  • 2
  • 13
  • 39

1 Answers1

7

Let $\epsilon > 0$ be a small constant tolerance. The following linear constraints enforce $x=1 \implies 0 \le y \le D$ and $x=0 \implies D+\epsilon \le y \le M$: $$0x + (D+\epsilon)(1-x) \le y \le Dx + M(1-x)$$

RobPratt
  • 32,006
  • 1
  • 44
  • 84