MIP/LP - Modelling “if distance(i,j)<=e then x=1” constraint

88 Views Asked by At

I want to add a constraint to my model that works like this:

if distance(i,j)<=e then x=1

The distance(i,j) is calculated based on euclidean distance between a determined point and an undetermined point that its coordinate is continuous variable in my problem. x is a binary variable.

could anyone help me with my problem?

1

There are 1 best solutions below

5
On BEST ANSWER

You can use a big-M constraint to enforce $d_{i,j} < e \implies x = 1$: $$e - d_{i,j} \le M_{i,j} x,$$ where $M_{i,j}$ is a (small) upper bound on $e - d_{i,j}$.

To enforce $d_{i,j} > e \implies x = 0$, use another big-M constraint: $$d_{i,j} - e \le (U_{i,j} -e) (1-x),$$ where $U_{i,j}$ is a (small) upper bound on $d_{i,j}$.