Exercise 3.21 [iterativelengtheningexercise]
On page iterativelengtheningpage, we mentioned iterative lengthening search, an iterative analog of uniform cost search. The idea is to use increasing limits on path cost. If a node is generated whose path cost exceeds the current limit, it is immediately discarded. For each new iteration, the limit is set to the lowest path cost of any node discarded in the previous iteration.

Show that this algorithm is optimal for general path costs.

Consider a uniform tree with branching factor $b$, solution depth $d$, and unit step costs. How many iterations will iterative lengthening require?

Now consider step costs drawn from the continuous range $[\epsilon,1]$, where $0 < \epsilon < 1$. How many iterations are required in the worst case?

Implement the algorithm and apply it to instances of the 8puzzle and traveling salesperson problems. Compare the algorithm’s performance to that of uniformcost search, and comment on your results.