Optimized number of permutations of mappings in heurisch()

Inorer to reduce the number of permuations of mapping we can remove the unnecessary_tuples that is one of the form (x, x_)
and can append these to the end of all permuted mappings
renamed store_tuple to unnecessary_permutations