Download HW1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CSB551 – Elements of Artificial Intelligence – Fall 2011
Homework #1
(Search Problems)
Due: 9/15/09 (5:15 pm)
How to complete this HW: Either 1) type your answers in the empty spaces below each
problem and print out this document, or 2) print this document and write your answers in the
empty spaces on the printout. Return the homework in class, during office hours, or slip it under
the door of Informatics East, Room 257 before 5:15 on Thursday, 9/15/09.
Your name: ………………………………………………………………………………………
Your email address: ……………………………………………………………………………
Note on Honor Code: You must NOT look at previously published solutions of any of these
problems in preparing your answers. You may discuss these problems with other students in the
class (in fact, you are encouraged to do so) and/or look into other documents (books, web sites),
with the exception of published solutions, without taking any written or electronic notes. If you
have discussed any of the problems with other students, indicate their name(s) here:
…………………………………………………………………………………………………
Any intentional transgression of these rules will be considered an honor code violation.
General information: Justify your answers, but keep explanations short and to the point.
Excessive verbosity will be penalized. If you have any doubt on how to interpret a question, tell us
in advance, so that we can help you understand the question, or tell us how you understand it in
your returned solution.
Grading:
Problem#
I
II
III
IV
Total
Max. grade
20
20
20
40
100
Your grade
Name …………………………………………………………………..
I. Map coloring (20 points)
Express the following problem as a search problem:
“You have to color the various regions of a planar map (for example, the map of the 48
contiguous states of the United States) using only four colors (Red, Blue, Yellow, and
Green), in such a way that no two adjacent regions have the same color.”
Give the general description of a state, the initial state, the goal test, and the successor function.
For the successor function it is not necessary that you write every possible “state  state”
combination, but you should make it clear how one would derive the successor states of any given
state. Note that we do not ask you to describe a solution of the problem!
Name …………………………………………………………………..
II. Missionaries and Cannibals (20 points)
In the classic Missionaries and Cannibals puzzle, your job is to move three missionaries and
three cannibals to the other side of a river using a boat that can only hold one or two people.
You may not leave the missionaries outnumbered on any bank of the river – otherwise the
cannibals will eat them.
Figure 1. A missionaries and cannibals game that can be played on the web at
http://www.plastelina.net/game2.html
1. State the Missionaries and Cannibals puzzle as a search problem. Give precise definitions
of the:
a. State space
b. Successor function
c. Initial state
d. Goal test
(There may be multiple formulations)
2. Draw a complete, labeled state graph for this problem (not a search graph). Indicate an optimal
solution path. (The graph should not be prohibitively large if your formulation in problem 1 is
correct)
3. What blind search algorithm would you use to solve this problem? Would you check for
repeated states?
4. Consider a generalized Missionaries and Cannibals puzzle with N missionaries and N cannibals.
How quickly does the state space grow with N? Can these problems always be solved for N>3?
Why or why not?
Name …………………………………………………………………..
III. Heuristic Search (20 points)
Consider the following state graph:
The state space consists of states S, A, B, C, D, E, G1, and G2. S is the initial state and G1 and G2
are the goal states. The possible actions between states are indicated by arrows. So, the successor
function for state S returns {A, B}; for A it returns {C, D}, etc... The number labeling each arc
(roughly at the mid-point of the arc) is the actual cost of the action. For example, the cost of going
from S to A is 3. The number in bold italic near each state is the value of the heuristic function h at
that state. For example, the value of h at state C is 3.
1. Fill the following table with the nodes successively added to the fringe by the best-first search
algorithm using the evaluation function f(N) = g(N) + h(N), where g(N) is the cost of the path
found from the initial node to node N. The algorithm does not check if a state is a re-visited
one or not (hence, there may be several nodes with the same state in the search tree). It
terminates only when it removes a goal node from the fringe. The states produced by the
successor function are always ordered in alphabetic order. In the rightmost column (#exp),
indicate the order in which nodes are expanded (i.e., are removed from the fringe). If a node is
not expanded, leave the corresponding cell empty. The first line of the table is filled for you. It
is possible that you do not need all the rows in the table. In this problem, you don’t have to
justify your answers.
N
1
2
3
State
S
g(N)
0
h(N)
10
f(N)
10
#exp
1
Name …………………………………………………………………..
4
5
6
7
8
9
10
11
12
13
2. Is the heuristic function h defined by values provided in the figure admissible? How do you
know? How does this affect the search?
Name …………………………………………………………………..
IV. Word Puzzle (Programming) (40 points)
Complete the programming assignment as described in hw1.pdf and run your program on the
provided test cases. Then answer the following written questions. (Don’t forget to submit your
source code on Oncourse!)
1. Describe your successor function.
a. How do you know it provides all legal successors and no other states?
2. Assume that the input words are of length n. For your successor function, state an upper
bound on the branching factor of the search tree.
3. Describe your heuristic function.
a. Show that it is admissible.
b. Show that it is consistent.
4. How does your heuristic function compare to the null heuristic?
a. Does it provide shorter paths?
b. Does it visit (i.e., expand) fewer nodes? How do you know?
c. How does it affect the running time of the search as a whole?
d. Does it take less time to run, per-state?