AI Homework 1 Solution: March 24, 2007
AI Homework 1 Solution: March 24, 2007
2. AIMA[3.8]
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.
a. Draw the portion of the state space for states 1 to 15.
b. Suppose the goal state is 11. List the order in which nodes will be
visited for breadth-first search, depth-limited search with limit 3, and
iterative deepening search.
c. Would bidirectional search be appropriate for this problem? if so,
describe in detail how it would work.
d. What is the branching factor in each direction of the bidirectional
search?
e. Does the answer to (c) suggest a reformulation of the problem that
would allow you to solve the problem of getting from state 1 to a
given goal state with almost no search?
1
Figure 1: The state space
Ans.
(a) The state space of this problem is as Figure 1:
(b) BFS: 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 → 9 → 10 → 11.
DFS: 1 → 2 → 4 → 8 → 9 → 5 → 10 → 11.
IDS: 1; 1 → 2 → 3; 1 → 2 → 4 → 5 → 3 → 6 → 7; 1 → 2 → 4 → 8 →
9 → 5 → 10 → 11.
(c) Yes. In this problem, the predecessor of each state x is b x2 c, which is
easily computable. Assume that we use breadth-first search in both
forward and backward direction, the search steps may be as Table 1.
Note that the algorithm stops when the search in backward direction
visited node 5, because node 5 is in the fringe of forward direction.
(d) 2 in forward direction, and 1 in backward direction.
(e) Yes. We start from goal state, and let node 1, the original start state,
be our new goal. For each state i, we have only one next state b x2 c.
Since the new problem has branching factor=1, we will not need to
search.
3. AIMA[3.12]
Prove that uniform-cost search and breadth-first search with constant step
costs are optimal when used with the GRAPH-SEARCH algorithm. Show
2
a state space with varying step costs in which GRAPH-SEARCH using
iterative deepening finds a suboptimal solution.
Ans.
Uniform-cost search is identical to breadth-first search if all step costs are
equal, you can just prove any one of the two methods.
Since the costs of each step are constant, when an unvisited node is visited
by breadth-first search (uniform-cost search), the cost will be the lowest
one. Moreover, since we use GRAPH-SEARCH algorithm, no node will
be visited more than once. Thus if the goal node is visited, we will get
the optimal solution.
The state space that iterative deepening search with GRAPH-SEARCH
algorithm will fail to find the optimal solution can be Figure 2, where I is
the initial state and G is the goal state: