Compute the most likely permutation of a lattice given an LM