added a generic distance function option to to robustness calculation so any distance can be used