Pam clustering: RFC and new features

Here is some of the new code for the PAM model.
The definition of the Distance is now independent so that it can be used by other models (e.g. KNN) and extended with other metrics.

Added the check for the spills and the re-computation of the distance.