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



Written questions [20 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). Each of these questions asks you to trace the behavior of an algorithm (e.g. backtracking). Please list the steps performed for each algorithm along with any justification, e.g. "Choose variable X next because it has only 1 remaining value left" or "Remove arc (X,Y) from queue and delete 1 from X's domain"

  1. [10 points] AIMA 6.5
  2. [10 points] AIMA 6.11
Programming project [80 points]

In this programming project, you will finally be up against ghosts! This assignment asks you to implement minimax, alpha-beta pruning, and expectimax to help Pac-man navigate through the maze without being killed by ghosts. In the previous programming project, there were some subtleties to implementing BFS, DFS, UCS, and A-star. In the same way, translating pseudocode into actual code for minimax, alpha-beta, and expectimax will involve some careful thinking. So make sure to give yourself enough time to really work through this assignment.

Here are some tips that may save you some time:

  • Note that for the pacman projects, a single search ply is defined as Pacman moving and then each of the ghosts moving in response.
  • Since there are multiple ghosts, your search tree is going to look different from the search trees we've seen in class. In particular, in class we've looked at 2-person games. The corresponding search trees alternated between MAX nodes at one depth and MIN nodes at the next. In this case, however, there are multiple opponents that move in succession. How does this alter the search tree?
  • Don't alter the agent's state (e.g. overwrite self.depth or self.index). The agent has a particular state. The agent will stop, run your algorithm, and take the specified action. In the course of computing the optimal action via minimax, you want to preserve the agent's state.

If you're ready, click here to begin.


Ungraded optional problems (Solutions to these problems will be posted after the homework due date.)
  1. For what types of problems will greedy local search (hill climbing) work better than simulated annealing?
  2. AIMA 5.8
  3. AIMA 6.7
  4. AIMA 6.12
  5. AIMA 6.16
  6. In this problem, we're goint to try formalizing the Sudoku game (from the previous homework) as a constraint satisfaction problem (CSP).
    1. What is the set of variables, and what is the domain of possible values for each?
    2. List all of the constraints for the problem, including the ones provided by the starting board. How many variables are involved in each constraint?
    3. We said in class that the order in which you consider variables can have a big impact on the performance of basic backtracking search in CSPs. Which variable ordering would you expect to work better, the degree heuristic, or the minimum remaining values heuristic? Why?
    4. An interesting recent finding about the 3-SAT problem is that the compute time required to solve a particular problem instance is correlated with the number of solutions that exist (problems with lots of solutions or exactly one solution are easy, but it's the ones in the middle that are hard). However, every Soduko problem has exactly one solution. What, then, is the difference between "easy" and "hard" Sudoku problems?

Submission Instructions

You'll be turning in the "multiagent" directory which should contain your modified multiAgents.py file. Add the pdf of your answers to the written questions to the "multiagent" directory. Rename the multiagent directory to hw3_LastNameFirstName. Zip (compress) your directory and upload it using this URL.




Last modified: Tue Feb 11 10:30:30 PST 2014