Uninformed Search Project

Uninformed Search
This assignment was first created and used for two semesters at the University of Southern California in the Artificial Intelligence Course CSCI561 and CSCI460. This project has been changed from its original form to make it more of a self-guided project.

Problem 1 - Preparation
Gung Ho Joe is a video game warrior. He is slashing his way through vile monsters when he comes upon the gratuitously tentacled Purple People Eater. He must act fast and dispatch the hideous foe before it splashes radioactive bacteria on him. There are a variety of items Joe can use to destroy this beast.


 * Joe has an M-16 with a grenade launcher and two types of bullet ammunition, Teflon® tipped and explosive tipped.
 * Joe is wearing a coat, which has inside it a very large .45 caliber gun, a rubber mallet and two Lakers tickets.
 * Joe has slung over his shoulder some really cool particle cannon and a weird alien hand that as far as we can tell, shoots bees.
 * Joe has a sack, which contains a hand grenade, a two-way radio, the galactic transponder and a small change purse, which has a nickel, two dimes and pocket lint inside.

Assume that any of these items can be used against the Purple People Eater. Also, assume that in order to use an item inside another i.e. coat or sack, Joe must first open it. As such, to use the nickel, Joe must first use the sack, then the change purse. Also, assume that the cost is the same for each edge in this problem.


 * 1) Draw the basic search tree assuming Joe will try all of these items against the people eater.
 * 2) Given the tree you have drawn, list the order that the items will be used in a breadth first search.
 * 3) Given the tree you have drawn, list the order the items will be used in a depth first search.
 * 4) Give an example from the tree of a depth-limited search with limit L=2 (the start node is at depth 0 and its children at depth 1).
 * 5) Would using an iterative deepening search be helpful in this example?
 * 6) Give the time and memory complexity for both depth first and breadth first search and give a simple derivation and explanation of how they are computed.
 * 7) If the Purple People Eater was a tollbooth operator in its past life and a dime will make it go away, will one of the search types be more optimal? Would your answer change if Joe needed to use the really cool particle cannon? Explain.
 * 8) How could you augment this problem to work with a Uniform-cost search? Intuitively, do you believe such an augmentation would make more sense?
 * 9) Does trying each item like this seem like a reasonable thing to do? In real life when would it be reasonable to do so?
 * 10) You might give some intuitive examples and explanations as to how else you might try and select the correct item for Joe to use.

Problem 2 Programming and Analysis
Homer Simpson is at the nuclear power plant. A plutonium rod has fallen on his head. He no longer remembers the way to Moe’s Tavern. You will need to help Homer find the way so he can enjoy a frosty Duff™ beer after work.

To accomplish this, you will be given a list of street intersections, which list the streets that meet each other. You will be required to create a program in GNU C++ (g++) that finds the list of streets Homer must travel on in order to get to Moe’s.

You may either use the g++ version on SomeCommonUnixServer or g++ versions 3.3 to 3.4.1 on Linux. Be sure and clearly note which one you used so I know which machine to compile it on.
 * If giving this to students, you might want to specify the compiler as such:

Of course c++ is optional. Java would also work well.

Your program should take in an arbitrarily large list of intersections and find the correct route to take. It will then output a list of each street taken in order (see example file). An example input would be a list of intersections (edges):

Nuclear_Plant Burns_Ave Burns_Ave West_Springfield_Bvld Burns_Ave Ye_Olde_Fortran_St Burns_Ave Krustofski_Way Moes_Tavern Krustofski_Way

Ideally, your program would return the output of streets and other connecting locations traveled over including the starting and finishing states, in order of travel:

Nuclear_Plant Burns_Ave Krustofski_Way Moes_Tavern

You can assume that capitalization will be maintained and node names will not have any white spaces in them. Additionally, the very first row has the starting state, while the very last row has the ending state just in the same way as the example. So, with other test cases, you must be able to help Homer find his way to other places as well. After all, you never know, he might want to go home to his loving family.

Hint: It may be helpful to use the C++ member function ‘compare’ or the C function ‘strcmp’ function to transform the street names into states. These functions will compare two strings to let you know how similar they are. Thus, one way to approach the problem is to read the list of streets and if a street name has not been read in yet, create a state for it. Thus, keep some sort of list for street names and which states they correspond to.

You may solve this problem using both depth first and breadth first search. Additionally, you should keep track of memory and time requirements. Time required is tracked by incrementing a counter for each node that is expanded. Memory required is tracked by storing the largest number of unexpanded nodes, which were stored in memory at any given time. These may be output by your computer program at the same time as the solution. Please keep in mind that the streets of Springfield can lead many places, including in circles. So you should be able to detect loops in this problem.

Ideally, you would like your program to output three files:

If your input is example01.txt, your output files will be:


 * 1) example01.depth.txt – this is your depth first search solution
 * 2) example01.breadth.txt – this is your breadth first search solution

You will be provided with at least one set of example solution files, which you can use to make sure your output, matches the standard (see below).

Thus your program should:


 * 1) Read in a list of names as detailed above and create associated states.
 * 2) Find the route from the start to the ending states.
 * 3) Write files with the solution routes, as detailed above.

If you have some problems with C++ or would just like a handy reference I recommend the following book:

C++ Black Book Steve Holzner ISBN 1-57610-777-9

It is available on amazon.com for $23.00. As far as C++ books go, it's rather comprehensive over all the basic C++ topics and has easy to read and understand examples.

Analysis and questions

 * 1) Analyze the memory and time requirements for depth first and breadth first search over the example files.
 * 2) Show the mean and standard deviation of the number of steps needed to execute depth and breadth first search.
 * 3) Show the mean and standard deviation for the amount of memory required given the examples. You can represent this as the maximum number of nodes, which must be kept in memory at any one time for each example.
 * 4) From your analysis, which of the two methods yields superior results.
 * 5) What if we added more than one goal state to each graph and we asked you to find the shortest (optimal) solution, would that change the complexity of the problem?
 * 6) What if in addition to adding more than one goal, we added a cost to each intersection (edge) such as the wait time at the traffic light. Would a breadth-first search still make sense?
 * 7) If Matt Groening stuffed all his money under a mattress, how large would his mattress need to be in order to cover all of his cash?

Assignment Material
Uninformed Search material.rar - Rar can be opened with WinRAR