Artificial Intelligence Homework 3
Due: 10/05/14 by 11:59pm
(Pair assignment)



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 is hill climbing better suited than simulated annealing?
  2. (Adapted from AIMA 4.1) Give the name of the algorithm that results from each of the following special cases:
    • Local beam search with k=1
    • Local beam search with one initial state and no limit on the number of states retained.
    • Simulated annealing with T=epsilon at all times where 0 < epsilon << 1. Note the "<<" symbol means much smaller than
    • Simulated annealing with T=infinity at all times.
  3. AIMA 6.7
  4. AIMA 6.16
  5. The Traveling Salesman Problem (TSP) can be stated as follows. A salesman needs to visit N different cities. Find a minimum distance path for the salesman that visits all N cities once and starts and ends in the same city. This question asks you to construct a Simple Genetic Algorithm (SGA) to solve this problem.
    • What are the states in the state space for the TSP? Note that for a local search algorithm, "states" are defined differently than "states" for an uninformed/informed search algorithm. If this doesn't make sense, do the next question first and then come back to this question.
    • How can we represent each state as a string over a finite alphabet?
    • Now define a fitness function. Recall that higher values correspond to "fitter" states.
    • Define a crossover function that takes two parents (i.e. two parent tours) and sensibly combines them to produce two offspring (i.e. two child tours)
    • Extra Credit: Implement your crossover function in Matlab. Write a Matlab function that takes in two parent strings and returns two offspring. Your function should have the following header:

      [offspring1, offspring2] = crossover(parent1, parent2)

      where the parents and offspring are permutations of the numbers {1, 2, ..., N} represented as vectors -- e.g., if N = 5 then your function should take in parent1 = [3 1 2 5 4] and parent2 = [5 1 3 2 4] and return two offspring vectors.

Submission Instructions for Working in Pairs
  • Include your first and last name in the filename for your written questions -- e.g., "written_questions_ChambersAmerica.pdf"
  • Put both your and your partner's pdf inside the "multiagent" directory.
  • Choose one person's name and rename the multiagent directory hw3_LastNameFirstName.
  • Zip (compress) your directory and upload it using this URL.


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