next up previous contents
Next: CHAPTER.9 RECORDSVECTORS Up: CHAPTER.8 AN AI Previous: Using solve_problem to

Exercises

1. The above strategy is not always the most efficient. See if there are ways of improving it e.g. by re-defining the next states generator or the insertion procedure.

2. Try using the above problem solver to set up a route finding program, using a database of information about road or rail links between towns, and then trying to find a route between any two towns. If you want the shortest route to be found you will have to have distance information and the insert procedure or the next states procedure, or both could use the distance measure to order the states, so that shorter routes are tried first. Text books on AI define alternative algorithms for doing this sort of thing.

3. Try using the problem solver to solve the problem of selecting some blocks from a pile of blocks to build a tower of exactly a given height. E.g. you may be given a list of numbers representing the heights of the available blocks:

    [3 16 12 22 5 5 24 14 8 7 22 11]
and the task of finding blocks to make a tower exactly 30 units high.

4. The above problem solver stops as soon as it finds a solution. If for some reason you wish to look for another solution to the same problem that could be very wasteful. Try extending the procedure so that it not only returns the solution, but enough information about what it has done so far to enable it to be re-started with that information. This will require a change to the procedure to allow it to be run with information saved from a previous run, which might default to [].



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998