Vous êtes sur la page 1sur 6

Quiz 1 Solutions

11 September 2017
For all the problems, assume that ties are broken alphabetically (so a partial plan
S->X->A would be expanded before S->X->B and S->A->Z would be expanded
before S->B->A). Your answer should be a string with S as your first character and
G as your last character.

1. (10 points) DEPTH-FIRST SEARCH (Using Tree Search)


Consider a depth-first graph search on the graph below, where S is the start and G is
the goal state. You may find it helpful to execute the search on scratch paper. Please
write the final path returned by depth-first search. Your answer should be a string
with S as your first character and G as your last character.

ANSWER: SBAG
Search Tree is on the right. Nodes with red circle are expanded nodes.

C B

B A

A G

G
2. (10 points) BREADTH-FIRST GRAPH SEARCH (Using Tree Search)
Consider a breadth-first graph search on the graph below, where S is the start and G
is the goal state. You may find it helpful to execute the search on scratch paper.
Please write the final path returned by breadth-first search. Your answer should be a
string with S as your first character and G as your last character.

ANSWER: SBG
The popped off sequence SBCAG is also counted as a correct answer.
Search Tree is on the right. Nodes with red circle are expanded nodes.

C B

A G A G
3. (30 points) COMPARE SEARCH TREES
Consider the search space below, where S is the start node and G1 and G2 satisfy
the goal test. Arcs are labeled with the cost of traversing them (so lower is better).

For each of the following search strategies, indicate which goal state is reached (if
any) and list, in order, all the states popped off of the fringe list. When all else is
equal, nodes should be removed from fringe in alphabetical order.

Breadth First (Using Tree Search)


Goal state reached: G1
States popped off the fringe: S-A-B-D-D-E-C-G1

Depth First (Using Tree Search)


Goal state reached: None
States popped off fringe: S-A-D-C-A-D-C-A-

Uniform-Cost Search (Using Tree Search)


Goal state reached: G2
States popped off fringe: S-A-B-D-C-E-A-F-G2

3
1 S B
5
A 8
2 E
1 1
5 D 4
C 14 6 F
2
4 0
G1 G2
Search Tree when using Breadth First Search. Nodes with red circle are expanded
nodes.

A B

D D E

C G1 G2 C G1 G2 F G2

A G1 A G1 G2
Search Tree when using Depth First Search. Nodes with red circle are expanded
nodes.

A B

D D E

C G1 G2 C G1 G2 F G2

A G1 A G1 G2

C G1 G2
Search Tree when using Uniform Cost Search. Nodes with red circle are expanded
nodes.

A B

D D E

C G1 G2 C G1 G2 F G2

A G1 A G1 G2

Problems Feedback:

Q1: Whether we should pop off the goal?


A1: Yes. Although you can check whether the state is a goal, it is better to pop off.

Mistakes Collections:
In todays tutorial session, there is a mistake in Q3 uniform-cost search algorithm:
F has a child which is node G2. Node G2 should be added in priority queue with
cost 11 when we pop off node F. But it does not affect the final result.
I am sorry for the mistake. Thanks the student who pointed out the mistake.

Vous aimerez peut-être aussi