CS 151: Artificial Intelligence
Homework 2
Due date: 2/10/14 by 11:59pm



Written questions [30 points]

Your answers to the following questions should be typed and submitted as a pdf (e.g. you can type your answers using Word and print to pdf or use LaTeX). The second question asks you to draw a portion of a search tree so you'll need to figure out how to "draw" the tree on the computer (e.g. using shapes in Word)

  1. [5 points] AIMA 3.6d (Give the states, initial state, actions, goal test, and action cost)
  2. [10 points] AIMA 3.15 (a and b only)
  3. [5 points] AIMA 3.18
  4. [10 points] AIMA 3.23
Programming project [70 points]

This programming project will ask you to implement 4 search algorithms to help Pac-man navigate through a maze in search of food. You will implement breadth-first search, depth-first search, uniform cost search, and A-star search. You will also experiment with developing consistent heuristics for Pac-man. Since this is the first Pac-man project, set aside additional time so that you can familiarize yourself with the existing Python infrastructure. Again, you can autograde your solutions to help you catch any bugs and errors.

If you're ready, click here to begin.


Ungraded optional problems (Solutions to these problems will be posted after the homework due date.)
  1. (Taken from http://www-nlp.stanford.edu/~grenager/cs121//handouts/hw1.pdf) Consider the popular game Sudoko in which one tries to fill a 9x9 grid of squares with numbers subject to the following constraints: every row must contain all of the digits {1...9}, every column must contain all of the digits {1...9}, and each of the 9 different 3x3 boxes must also contain all of the digits {1...9}. Some of the boxes are already filled with numbers. Here is a sample board:

    Each game is guaranteed to have a single solution. That is, there is only one assignment to the empty squares which satisfies all of the constraints. For the purposes of this homework, let n(i,j) refer to the number in row i and column j of the grid. Also, assume that M of the numbers have been specified in the starting problem (M=27 in the above picture).

    1. Formalize this problem as an incremental search problem. What are the start states, the successor function, the goal test, and the past cost function?
    2. What is the branching factor, solution depth, and maximum depth of the search space? What is the size of the state space?
    3. Which of the following would you recommend for solving the incremental search formulation of this problem: DFS, BFS, or Iterative Deepening (ID)? Why? What's the worst-case time and space complexity of your algorithm for this problem? (Provide a number for each not an algebraic expression)
  2. AIMA 3.6d
  3. AIMA 3.10
  4. AIMA 3.21
  5. AIMA 3.29

Submission Instructions

You'll be turning in the "search" directory which should contain your modified search.py and searchAgents.py Python files. Add the pdf of your answers to the written questions to the "search" directory. Then rename the "search" directory to "hw2_LastNameFirstName". Zip (compress) the directory and upload it using this URL.




Last modified: Sun Jan 26 15:15:14 PST 2014