# CS 1571: Homework 2

## Search (Chapters 3 and 4): Paper Problems

Assigned: September 16, 2008

Due: September 23, 2008

### 1. More Blind Search (30 pts)

As in Problem 2, Homework 1, again consider a state space where the start state is number 1 and the successor function for state n returns two states, numbers 2n and 2n+1.

Suppose the goal state is 11. List the order in which nodes will be visited for
i. depth-limited search with limit 4
ii. iterative deepening search

### 2. Greedy Search (35 pts)

Consider a graph with nodes A, B, C, D, E, F, G, and S. The start state is S and the goal state is G. The edges in the graph are as follows: (A,B,4), (A,D,5), (A,S,2), (B,C,4), (B,E,6), (B,F,3), (C,G,1), (D,E,3), (D,S,3), (E,F,4), (F,G,5). (The notation (A,B,4) means that there is an edge between nodes A and B, and that the cost of traveling that edge is 4.)

Nodes should be expanded alphabetically if two or more nodes have the same evaluation cost. Use the following table for the heuristic function:

n | S | A | B | C | D | E | F | G
h(n) | 10 | 7 | 3 | 1 | 5 | 4 | 2 | 0

Use Greedy Best First search to
i. List the nodes in the order they would be generated.
ii. List the nodes that lie along the final correct path to the goal.
iii. What is the cost of the solution? Is it optimal? Explain.
iv. Give an example illustrating how A* would change this search.

### 3. A* Search (35 pts)

Consider a sliding block puzzle with the following initial configuration:
|B|B|B|W|W|W|E|
There are 3 black tiles (B), three white tiles (W), and an empty cell (E).

The puzzle has the following moves:

- A tile may move to an adjacent empty cell with a cost of 1.
- A tile may hop over at most two other tiles into an empty cell with a cost equal to the number of tiles hopped over.

The goal of the puzzle is to have all of the white tiles to the left of all the black tiles (without regard to the position of the blank cell). There are many possible ideas for a heuristic. One could be #white tiles to right of leftmost black tile.
i. Is the given heuristic admissable? Why or why not?
ii. Using the given heuristic, show the first 10 generated nodes produced by the A* algorithm.