Add optimize distance matrix