fixed greedy planner to make it work with shrinking number of machines