def SFpp(layout, s_d, rank, n): ub = 100 cont = 0 for r in rank: while True: (s, pos) = search_highest(layout, r, ub, s_d) if layout.sorted_elements[s] > len(layout.stacks[s]) + pos: break #element is sorted c = force_move(layout, s, pos, s_d) ub = r cont += 1 if cont == n: return if r == c: break while cont < n: Greedy.SF_move_d(layout, s_d) cont += 1