CMSC 471

Artificial Intelligence -- Fall 2002

HOMEWORK THREE
out 9/25/01 due 10/11/01

http://www.cs.umbc.edu/courses/undergraduate/471/fall02/hw/hw3.html



PART I.  Implementing search (100 pts.)

In this assignment, you will implement and compare several search techniques.

Reminders:

Assignment

Write and compare three search methods: breadth-first search with checking for repeated states, greedy search, and A* search. You should write three functions, BF-search, greedy-search, and A*-search, that each take a single argument--the name of a city on the map--and search for the shortest path to Bucharest. (More generally, one could write a function that took two cities and searched for a path from one to the other, but then you would need straight-line distances between every pair of cities.)  The search functions should return the following four values:
  1. The number of nodes expanded
  2. The cost of the path found
Use the Lisp function values to return these four values. h(n), the heuristic function that is used by the A* and greedy search algorithms (i.e., the estimate of the distance to the goal), should be the straight-line distance to Bucharest.

Results to Report

You should turn in your code using the submit facility. Please create a single file containing all of the code, including the code from homework #2 (whether you reuse your own code or use the code provided as a solution). Name this file hw3-NAME.lisp, where NAME is your first name.

In addition, you should turn in, in hardcopy, both a printout of your code and the results of the three search functions applied to each city in Romania (as the first argument) and Bucharest (as the second argument), using the following table format as a guideline. (You can write a Lisp function to collect these results and print out a table like this, or you can run the functions for each city and then create the table manually. If it's easier, you can provide the same information in a different format, as long as it's clearly readable, all of the data shown below is given, and you show the results for the 20 cities in alphabetical order. Hint: you will probably want to write a testing loop that runs all of the algorithms on all of the cities and gathers the results in some central place, then outputs the tabular data.) In the case where a search method fails to find a path, you should indicate the lack of a result (e.g., with "--" , NIL, or "FAILURE") in the corresponding table entry.
City name #nodes / BFS # nodes / greedy # nodes / A* Path cost / BFS Path cost / greedy Path cost / A*
Arad             
Bucharest            
...            
Vaslui            
Zerind            

You should also write a brief summary of your findings, comparing the performance of the algorithms, and discussing particular cases where one of the algorithms performs better than the others. (This summary can be anywhere from a paragraph to a page or two.)

Implementation Suggestions

Before reading these suggestions, it would be a good idea to design your own approach.  However, if you get stuck or want a "reality check," here are some suggestions for how to go about implementing the search methods in an efficient and reasonably elegant way. (You are not required to follow these suggestions.)