Docsity

Artificial Intelligence Questions, Exams of Engineering

Toggle sidebar
bg1
CS 188
Spring 2024 Regular Discussion 1
1 Search Algorithms in Action
For each of the following graph search strategies, work out the order in which states are expanded, as well
as the path returned by graph search. In all cases, assume ties resolve in such a way that states with earlier
alphabetical order are expanded first. Remember that in graph search, a state is expanded only once.
a) Depth-first search.
b) Breadth-first search.
c) Uniform cost search.
1
pf3
pf4

Partial preview of the text

Download Artificial Intelligence Questions and more Exams Engineering in PDF only on Docsity!

CS 188

Spring 2024 Regular Discussion 1

1 Search Algorithms in Action

For each of the following graph search strategies, work out the order in which states are expanded, as well as the path returned by graph search. In all cases, assume ties resolve in such a way that states with earlier alphabetical order are expanded first. Remember that in graph search, a state is expanded only once.

a) Depth-first search.

b) Breadth-first search.

c) Uniform cost search.

2 Search and Heuristics

Imagine a car-like agent wishes to exit a maze like the one shown below:

  1. The agent is directional and at all times faces some direction d ∈ (N, S, E, W ).
  2. With a single action, the agent can either move forward at an adjustable velocity v or turn. The turning actions are left and right, which change the agent’s direction by 90 degrees. Turning is only permitted when the velocity is zero (and leaves it at zero).
  3. The moving actions are fast and slow. Fast increments the velocity by 1 and slow decrements the velocity by 1; in both cases the agent then moves a number of squares equal to its NEW adjusted velocity (see example below).
  4. A consequence of this formulation is that it is impossible for the agent to move in the same nonzero velocity for two consecutive timesteps.
  5. Any action that would result in a collision with a wall or reduce v below 0/above a maximum speed Vmax is illegal.
  6. The agent’s goal is to find a plan which parks it (stationary) on the exit square using as few actions (time steps) as possible.

As an example: if at timestep t the agent’s current velocity is 2, by taking the fast action, the agent first increases the velocity to 3 and move 3 squares forward, such that at timestep t + 1 the agent’s current velocity will be 3 and will be 3 squares away from where it was at timestep t. If instead the agent takes the slow action, it first decreases its velocity to 1 and then moves 1 square forward, such that at timestep t + 1 the agent’s current velocity will be 1 and will be 1 squares away from where it was at timestep t. If, with an instantaneous velocity of 1 at timestep t + 1, it takes the slow action again, the agent’s current velocity will become 0, and it will not move at timestep t + 1. Then at timestep t + 2, it will be free to turn if it wishes. Note that the agent could not have turned at timestep t + 1 when it had a current velocity of 1, because it has to be stationary to turn.

(a) If the grid is M by N , what is the size of the state space? Justify your answer. You should assume that all configurations are reachable from the start state.

(b) Is the Manhattan distance from the agent’s location to the exit’s location admissible? Why or why not?

(c) State and justify a non-trivial admissible heuristic for this problem which is not the Manhattan distance to the exit.

(d) If we used an inadmissible heuristic in A* graph search, would the search be complete? Would it be optimal?

(e) Give a possible advantage that an inadmissible heuristic might have over an admissible one.

# admissible # inadmissible

(iv) h(n) = the number of remaining ghosts.

# admissible # inadmissible

(b) Suppose that Pacman has exactly one less Pacfriend than there are number of ghosts :) ; therefore P = G. Recall that Pacman and his Pacfriends are indistinguishable from each other. (i) What is the size of the minimal state space representation given this condition? Recall that P = G.

# M N P

# M N GP

# (M N )G

# (M N )(G+P^ )

# (M N )P^2 G

# (M N )GP

# (M N )G+

# (M N )(G+1)P

M N

P

M N

P

2 G

M N

P

(M N )G

M N

P

M N

G

# 2 M N

# 2 M N^ +G+P

# GP (2)M N

For each of the following heuristics, select whether the heuristic is admissible or inadmissible. Recall that P = G.

(ii) h(n) = the largest of the Manhattan distances between each Pacman and its closest ghost.

# admissible # inadmissible

(iii) h(n) = the smallest of the Manhattan distances between each Pacman and its closest ghost.

# admissible # inadmissible

(iv) h(n) = the number of remaining ghosts.

# admissible # inadmissible

(v) h(n) = number of remaining ghosts P.

# admissible # inadmissible