You are on page 1of 4

CS 540-1

Fall 2016

CS 540-1: Introduction to Artificial Intelligence


Homework Assignment # 2
Assigned: 9/20
Due: 9/27 before class

Hand in your homework:


This homework includes only a written portion. Please type the written portion and hand in a
pdf file named hw2.pdf. Go to Learn@UW My Course Dashboard, choose the 540 course, choose
Assignments/Dropbox, click on hw2: this is where you submit your file.

Late Policy:
All assignments are due at the beginning of class on the due date. One (1) day late, defined as a
24-hour period from the deadline (weekday or weekend), will result in 10% of the total points for the
assignment deducted. So, for example, if a 100-point assignment is due on a Wednesday 9:30 a.m., and
it is handed in between Wednesday 9:30 a.m. and Thursday 9:30 a.m., 10 points will be deducted. Two
(2) days late, 25% off; three (3) days late, 50% off. No homework can be turned in more than three (3)
days late. Written questions and program submission have the same deadline. A total of two (2) free
late days may be used throughout the semester without penalty.
Assignment grading questions must be raised with the instructor within one week after the assignment
is returned.

Collaboration Policy:
You are to complete this assignment individually. However, you are encouraged to discuss the general
algorithms and ideas with classmates, TAs, and instructor in order to help you answer the questions.
You are also welcome to give each other examples that are not on the assignment in order to demonstrate
how to solve problems. But we require you to:
not explicitly tell each other the answers
not to copy answers or code fragments from anyone or anywhere
not to allow your answers to be copied
not to get any code on the Web
In those cases where you work with one or more other people on the general discussion of the
assignment and surrounding topics, we suggest that you specifically record on the assignment the names
of the people you were in discussion with.

CS 540-1

Fall 2016

Problem 1. Search [60]


Given the undirected, unweighted graph in Figure 1, find the shortest path from A to G using different
search algorithms. Perform cycle checking: if a node already occurred on the path back to the root, do
not generate it as a successor. To break ties, assume nodes are expanded (taken out of the OPEN data
structure) in alphabetical order with everything else being equal.
For each algorithm, write down
The list of states expanded in the order they are goal-checked;
The solution path found.

Figure 1: The unweighted, undirected graph


a) [10] Breadth First Search.
b) [10] Depth First Search.
c) [10] Iterative Deepening.

CS 540-1

Fall 2016

Now suppose we have different edge costs and heuristic function h as in Figure 2.

Figure 2: The weighted graph and the h() function


d) [10] Perform Uniform Cost Search. In addition to the previous requirements, also write down the
content of the priority queue at each step of the algorithm. It is sufficient to list the nodes in the priority
queue together with their priority scores (i.e. you do not need to draw the priority queue as a heap).
e) [20] Perform A* search with the given heuristic function h() using the algorithm in the lecture slides.
Write the states of OPEN and CLOSED in each step of A* algorithm, together with the appropriate
node score and back pointer. For example:
Step
1
2

OPEN
A(score, backpointer)
C(score,
backpointer),
B(score,
backpointer),
D(score, backpointer)

CLOSED
A(score, backpointer)

Table 1: A* Search

CS 540-1

Fall 2016

Problem 2. Path Check DFS [40]


Consider the following graph where the initial state is S and there is no goal state.

1.

[10] Run path check DFS. Write down all nodes in the order they are goal-checked (hint: you will
have repeats).

2.

[10] Lets call the depth 1 at the A nodes, 2 at the B nodes, and so on. For such a graph with
depth d, how many goal-checks will be performed? You should write down a formula, not a long
sum.

3.

[20] Repeat the two questions above, but for memorizing DFS instead.

You might also like