In Peter Norvig's Paradigms of Artificial Intelligence Programming, chapter 4, which is about the all-famous General Problem Solver (GPS). In this chapter, the author asks a question (4.4), which is as follows:
The Not Looking after You don't Leap Problem
Write a program that keeps track of the remaining goals so that it doesn't get stuck considering only one possible operation when others will eventually lead to the goal.
achievetake an extra argument indicating the goals that remain to be achieved after the current goal is achieved.
achieveshould succeed only if it can achieve the current goal and also
achieve-allthe remaining goals."
Here's the description of these functions
achieve: We input a goal, the list of operators, and the current state, in the
achievefunction, which checks if the goal is in the
statealready, if not, then checks if the goal is recursive, if not, then finds all the
appropriateoperators and then applies them, until the goal os achieved. Or
achievereturns a nil.
achieve-all: This has a list of goals as an input, which it tries to achieve using the
achievefunction. Moreover, it makes sure that all the goals are in the final state. Otherwise, it returns a nil.
The problem that I face is to find a relation between "getting stucked" over an operator and maintaining the number of goals remaining. Moreover, the version of
achieve in the GPS program checks for all the operators that can achieve the goal, and then apply only the one that does the work.
Let's forget this for a while, and consider the hint. It says that we should have an extra argument maintaining the goals that are remaining. But how will it help a goal, which is stuck because of applying the wrong operator?
There seems to be no relation between them. I know I'm missing something here, but I can't find that.