Docsity

6 Problems on Basic Search Strategy I - Assignment 1 | CAP 4621, Assignments of Computer Science

Toggle sidebar
bg1
Homework One Solutions
Problem 1 – Basic Search Strategy I
Consider the search tree shown below. The root (initial state) is at the top, and
the goal states are represented by double circles. Which goal state is reached will
depend on the search strategy applied. For each of the search strategies listed
below, indicate which goal state is reached (if any) and list, in order, the states
expanded. (A state is expanded when the node containing it is removed from the
queue). Assume that the successor function returns a state’s successors in the left-
to-right order. Note that search ends whenever a goal is reached or there is no
further states to expand.
1. Breadth-First Search: A, B, D, F, G, I (goal).
2. Depth-First Search: A, B, F, G, M, N, T (goal).
3. Uniform-Cost Search: A, B, G, D, K, F, N, R, Y (goal).
4. Greedy Search (use f=h): A, B, G, M, N, T (goal).
5. A∗Search (use f=g+h): A, B, G, D, K, N, R, Y(goal).
6. Hill Climbing Search: (Find a minimum of h) A, B, G, M (a local mini-
mum). No goal is reached using this algorithm. We get stuck with a local
minimum.
1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download 6 Problems on Basic Search Strategy I - Assignment 1 | CAP 4621 and more Assignments Computer Science in PDF only on Docsity!

Homework One Solutions

Problem 1 – Basic Search Strategy I

Consider the search tree shown below. The root (initial state) is at the top, and the goal states are represented by double circles. Which goal state is reached will depend on the search strategy applied. For each of the search strategies listed below, indicate which goal state is reached (if any) and list, in order, the states expanded. (A state is expanded when the node containing it is removed from the queue). Assume that the successor function returns a state’s successors in the left- to-right order. Note that search ends whenever a goal is reached or there is no further states to expand.

1. Breadth-First Search: A, B, D, F, G, I (goal). 2. Depth-First Search: A, B, F, G, M, N, T (goal). 3. Uniform-Cost Search: A, B, G, D, K, F, N, R, Y (goal). 4. Greedy Search (use f = h ): A, B, G, M, N, T (goal). 5. A∗^ Search (use f = g + h ): A, B, G, D, K, N, R, Y(goal). 6. Hill Climbing Search: (Find a minimum of h) A, B, G, M (a local mini- mum). No goal is reached using this algorithm. We get stuck with a local minimum.

Problem 2 – Basic Search Strategy II

Consider the state-space graph (not a tree !!) shown below. In this graph, the start and the two goal states are labelled, and the arcs are oriented as indicated by the arrows. For each of the search strategies listed below, indicate which goal state is reached (if any), and list, in order, the states expanded. When all else is equal, nodes should be expanded in alphabetical order. Note that search ends whenever a goal is reached or there is no further states to expand.

1. Breadth-first Search: Start, A, B, D, E, F, Goal2. 2. Iterative Deepening Search: Start A, B, D, Start, A, E, B, F, D, Goal2. 3. Uniform-Cost Search: Start, B, F, A, C, D, E, Goal1. 4. Greedy Search (use f = h ): Start, D, Goal2. 5. A∗^ Search (use f = g + h ): Start, D, A, B, F, Goal2. 6. Hill Climbing Search: Start, D, Goal2.

however. For example, for H 2 , we have

H 2 (n) = (h 1 (n) + h 2 (n) + h 3 (n))/ 3 ≤ (h 1 (n′) + C(n, n′) + h 2 (n′) + C(n, n′) + h 3 (n′) + C(n, n′))/ 3 = (h 1 (n′) + h 2 (n′) + h 3 (n′))/3 + C(n, n′) = H 2 (n′) + C(n, n′).

Similarly for H 4. H 3 is a little less trivial. However, we should expect that it is not consistent because of the multiplications. The simplest thing to do is to come up with three consistent heuristic functions such that H 3 violates the triangular in- equality for one node. To do so, let’s suppose we have a tree with just two nodes, n and n′^ (n is the parent of n′). Let C(n, n′) = 4. Pick h 1 (n′) = h 2 (n′) = 4, h 3 (n′) = 5 and h 1 (n) = h 2 (n) = 8, h 3 (n) = 9. Clearly, h 1 , h 2 , h 3 are consistent. However, H 3 (n) = 3

9 ∗ 8 ∗ 8 = 8. 3203 and H 3 (n′) = 3

5 ∗ 4 ∗ 4 = 4. 3089. We have H 3 (n) > H 3 (n′) + 4.

  1. From above, we know that both H 2 and H 3 are admissible (and consistent). We know that if H 2 dominates H 3 , then H 2 is more efficient than H 3. However, be- cause we also know that an arithmetic mean (H 2 ) is always greater than or equals to geometric mean (H 3 ). This implies that we should use H 2.

Part 2 (Problem 4.2 on page 134.) The heuristic path algorithm is a best-first search in which the objective func- tion is f (n) = (2 − w)g(n) + wh(n) for some real number w, where h(n) an admissible heuristic function and g(n) is the cost to reach node n from the root. For what values of w is this algorithm guaranteed to be optimal? What kind of search does this perform when w = 0? When w = 1? and When w = 2?.

Solution : First, notice that the search using a function f (n) is the same as the search using kf (n) for any positive constant k. Now, when w = 0, we have f (n) = 2g(n). So the search is equivalent to the one using f (n) = g(n), which is the uniform-cost search. When w = 1, we have A∗-search because f (n) = g(n) + h(n). For W = 2, we have the greedy search with f (n) = h(n). Factoring out (2 − w), we have

f (n) = (2 − w)(g(n) +

w 2 − w

h(n)).

Therefore, using f (n) is the same as using (g(n) + (^2) −ww h(n)). It is optimal when the heuristic function (^2) −ww h(n) is admissible. This requires that (^2) −ww ≤ 1. That is w ≤ 1.

Part 3 Suppose that you are given a heuristic function h that is not admissible. So that h(n) over-estimates the true path cost from n to the goal. However, suppose that h(n) is not too bad in the sense that it over-estimates the true path cost by no more than a constant μ. That is, for each state n, h(n) ≤ C(n) + μ, where C(n) is the true path cost from n to the goal. Show that A∗^ search using h(n) returns a solution whose path cost exceeds that of the optimal path by no more than μ.

Solution : Suppose n and n′^ are two goals such that n is an optimal goal. Let f (n) = g(n) + h(n) be the evaluation function using this h(n). If we reach the non- optimal goal n′^ first, we must have f (n′) < f (n) because we are using A∗^ search. However, we have

g(n′) ≤ g(n′) + h(n′) = f (n′) < f (n) = g(n) + h(n) ≤ g(n) + μ.

That is, the non-optimal path cost (g(n′)) can not exceed the optimal path cost (g(n)) by more than μ.

good comparison method that tells x is better than y whenever h(x) < h(y). This is good but not good enough for A∗^ because for A∗, we need to evaluate f (n) = g(n) + h(n), and use f (n) to determine which node is the best to explore next. It is entirely possible that we have two nodes such that h(n′) < h(n) (n′^ is better than n) but f (n) < f (n′).

Problem 5 – PEAS

For each of the following agents, develop a PEAS description of the task environ- ment (pages 38-43 in the textbook):

  1. Robot Chess player;
  2. Robot baseball player
  3. Autonomous Mars rover;
  4. Mathematician’s theorem-proving assistant.

Solution : I will leave this problem to you..... As long as you can justify your answers.

Problem 6 – Minimax Algorithm

Apply the minimax algorithm to the game tree below, where it is maximizer’s turn to play. The utility values are indicated below the leaf nodes. Compute the minimax values for all the interior nodes, and indicate the proper move of the maximizer: the move should be represented by the left child node or right child node? There is one leaf node whose utility value is not needed when applying

minimax algorithm to the game tree above. Which one? Explain why it is not necessary.

Solution : The minimax values for interior nodes are shown below: The move should be represented by the left child with larger minimax value. The fourth leaf node from the left, the one with − 8 utility value, does not need to be examined. This is because, after examining its only sibling (the node with value 6 ), we know that the minimax value for its grandparent node has to be 4.