I'm studying Operations Resarch and the professor give us the following problem:
• There is a 10*10 matrix in which there are 20 villages on random coordinates.
• We have to drop two supply packages (let's say a and b).
• Once a packages are dropped, each village is assigned to the closest package.
The objective is to find Xa,Ya and Xb,Yb in order to minimize the sum of these distances.
The problem is that the model has to be linear (Linear Programming) and with less than 300 variables. I think I found a model but I've used the non-linear distance function.
There's a way to linearize it?
Thanks.
Edit: my current model is:
$ X_1 $= row of the first package
$ Y_1 $= column of the first package
$ X_2 $= row of the second package
$ Y_2 $= column of the secondo package
$ X_vi $= row of the i-village
$ Y_vi $= column of the i-village
forall i from 1 to 20.
define $d_xi$ as the distance of the i-village from the x-package $$ d_1i = sqrt[2]((X_1 - X_vi)^2 + (Y_1 - Y_vi)^2) $$ $$ d_2i = sqrt[2]((X_2 - X_vi)^2 + (Y_2 - Y_vi)^2) $$
logic variables:
$ L_1i $= 1 iif d_1i less than d_2i, 0 otherwise
$ L_2i $= 1 iif d_2i less than d_1i, 0 otherwise
objective function:
minimize: $ \sum_{i=0}^{20} ((d_1i * L_1i) + (d_2i * L_2i)) $
constraints:
$ L_1i + L_2i = 1 \tag 1$
$ (d_2i - d_1i) * L_1i >= 0 \tag 2$
$ (d_1i - d_2i) * L_2i <= 0 \tag 3$
• all the coordinates are contained in {1,2,...,10}
i think this is less-equal-than 300 variables
Here's a mixed integer linear programming formulation with 220 variables and $1+20\binom{100}{2}$ linear constraints. Let $V=\{1,\dots,20\}$ denote the set of villages. Let parameter $d_{i,j}^v$ denote the distance from village $v$ to location $(i,j)$. Let $$P=\{(i_1,j_1,i_2,j_2)\in\{1,\dots,100\}^4:i_1 < i_2 \lor ((i_1 = i_2) \land (j_1 < j_2))\}$$ be the set of pairs of distinct locations. Let binary decision variable $y_{i,j}$ indicate whether a package is dropped at $(i,j)$, as in @Kuifje's answer. Let decision variable $z_v$ be the distance from village $v$ to the closest package. The problem is to minimize $\sum_v z_v$ subject to: \begin{align} \sum_{i,j} y_{i,j} &= 2\\ z_v &\ge \min\left(d_{i_1,j_1}^v,d_{i_2,j_2}^v\right)(y_{i_1,j_1}+y_{i_2,j_2}-1)&&\text{for all $v\in V, (i_1,j_1,i_2,j_2)\in P$}\\ y_{i,j} &\in\{0,1\}&&\text{for all $i,j$} \end{align} The idea is that $y_{i_1,j_1} = y_{i_2,j_2} = 1$ forces $z_v \ge \min\left(d_{i_1,j_1}^v,d_{i_2,j_2}^v\right)$.