Mixed Integer linear programming - absolute value of a variable not involved n the objective function

1.8k Views Asked by At

I'm looking to find the absolute value of the expression s-t. I have begun by introducing the following constraints:

enter image description here

Where A is the absolute value. Unfortunately, A is not involved in the objective function, so I need to constrain it from above as well. What other constraints do I need to introduce to achieve this.

1

There are 1 best solutions below

0
On BEST ANSWER

You are indeed missing some equations. Here is a way.

Define $x$ the Boolean variable equal to 1 iff $s-t \geq 0$. If you know an upper bound $B$ on $|s-t|$, $x$ is defined by

$s-t \leq Bx$

$t-s \geq B(x-1)$

Then you can define $A$ as

$s-t \leq A$

$t-s \leq A $

$A \leq s-t + B(1-x) $

$A \leq t-s + Bx $

Note that the bigger $B$ is, the less efficient the linear relaxation will be.

There are some other ways, but all the other ones I know are way more expensive in terms of number of variables.