Let $(X,d)$ be a metric space and $a,b\in X^n$ be two arrays of elements of $X$. Define $$ \rho(a,b):=\inf\limits_{\sigma\in \Sigma}\sup\limits_{1\leq i\leq n}d(a_i,b_{\sigma(i)}) $$ where the $\inf$ is taken over all possible permutations $\sigma$ of the set $\{1,\dots,n\}$. I wonder, how given a matrix of positive reals $\rho_{ij} = d(a_i,b_j)$ to find $\rho$ in a fast way.
In case this question better fits more CS-oriented website, please close it - I ask it on stackoverflow.