# What is the value range for absolute value formulation of binary variable

According to this link binary variables - absolute values the formula of some binary variables like absolute value is :

y = | x1 - x2| for two variables x1, x2 with 0 ≤ xi ≤ U

Introduce binary variables d1, d2 to mean

d1 : 1 if x1 - x2 is the positive value d2 : 1 if x2 - x1 is the positive value

MIP formulation

0 ≤ xi ≤ U [1.i]

0 ≤ y - (x1-x2) ≤ 2 · U · d2 [2]

0 ≤ y - (x2-x1) ≤ 2 · U · d1 [3]

d1 + d2 = 1 [4]

Notice the bolded numbers, what do these 2s represent? Do they represent the value range? Aren't the value range is only from 0 to 1?

Sorry, I'm totally new to this.

• if $$d_1 = 1$$, then $$d_2 = 0$$, and $$y = x_1 - x_2$$. That means that: $$y - (x_1 - x_2) = 0 \leqslant 2 \times U \times d_2 = 0$$
• if $$d_1 = 0$$, then $$d_2 = 0$$, and $$y = x_2 - x_1$$. That means that: $$y - (x_1 - x_2) = 2x_2 - 2x_1 \leqslant 2\times U - 2\times 0 = 2\times U \times d_2$$
• $d_1$ and $d_2$ take values in $\{0,1\}$. Those are the binary decision variables. Mar 17 at 11:50
• What are you saying? Those 2's are representing 2, not 1… This is $2 = 1 + 1$, because there is two occurrences of $x_1$ and $x_2$. Honestly, I don't even understand what is the problem. $x + x = 2x$, and this $2$ is not $1$. Mar 17 at 15:46