complete optimization with expand distance matrix.