IMHO, better use tree depth counters and return the Plan via an accumulator. If the pruning expression ((nonvar(Plan), Plan = ) -> fail true ) that I put at the start of the search branch of plan/3 irritates, then so should the iterative deepening trick. This may be further explained in the textbook, which I don't have, and it took some time to realize what is actually happening in this code. The first case occurs only at the very top node of the implied search tree. It is very clever but on second thoughts, it is too clever by half as it is based on the predicate run/3 behaving differently when being called with Plan an unbound variable than with Plan being a bound variable. Note the trick for making this an "iterative deepening" search.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |