An Algorithm for Ranking All the Assignment in Order of Increasing Cost