[CS logo]

CMSC 25000 - Artificial Intelligence
Winter 2004
Homework #2: Due January 20, 2004


Goals

Through this assignment you will:

Background

Files for this homework assignment can be found here

When trying to find cheap airfares, one often encounters itineraries and routes that are convoluted to say the least. Here we exploring routing through a hypothetical airline's system to locations that may be off the beaten path. Any resemblance these routes bear to itineraries suggested by on-line travel planners is purely coincidental.

The bulk of the code for this problem set can be loaded by airsearch.scm. The large data file is in airroutes.scm

The main search function is (generalized-search start finish finish? merge-paths-into-queue how-many successors)

The main data abstractions are as follows:

Problem 1

Since we are searching a graph rather than a tree, there are some additional details that must be handled. To explore one of these difficulties try the following simple search: (step-by-step '(chicago-midway)). This function incrementally and interactively extends the search path. Press 'y' a few times to observe its behavior.

What problem you observe?

Fix the problem in extend-path and hand in your code and the output of a run on the above example to demonstrate that it works.

Problem 2

The source code contains a stub for the depth-first procedure. Complete the implementation, debugging your code on the test data.

When it works, run your completed code on (depth-first 'newark 'san-francisco using the (loadrealdata) to load the real data.

Turn in your modification of depth-first and the verbose output for the above run.

Problem 3

In class we discussed the relationship between depth-first and breadth-first search. We also know how irritating it is to have a large number of connecting flights, and would like to find the route with the fewest hops.

Implement a function breadth-first. Debug using the small test data set.

When your code is operational, load the real data and run (breadth-first 'newark 'san-francisco). Hand in your function code, and the verbose output from the run.

Problem 4

Just finding a route is useful, but we'd really prefer to find the SHORTEST route efficiently.

Implement a version of a-star search. Run your version of a-star on the above example. Consider using a hash table to implement dynamic programming.

You will probably need to modify some of the data abstractions since we are now concerned with path costs as well. We have included a function straight-line-distance to aid in your search. The library loaded at the top of the code should also import a quicksort function.

What differences are there? What savings do you gain?