Assignment 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ASSIGNMENT 2

Exercise 1: Find the state representation of the following problem, given the start
state and the end state as shown below.

Start state Goal state

The checked square is empty and any number may be moved to the space.
Assume that the checkered square can be moved left, right, top or bottom.

Exercise 2: Find the optimal path of going from the start point a to the goal state
(house) using the A* algorithm. The heuristic for each node is provided next to the
node.

Exercise 3 (Adopted from Russel and Norvig): Suppose two friends live in different
cities on a map shown below. On every turn, each of the friends can simultaneously
move to a neighboring city. The amount of time needed to move from city 𝒊 to
neighbor 𝒋 is equal to the road distance 𝑑(𝑖, 𝑗) between the cities, but on each turn
the friend that arrives first must wait until the other one arrives (and calls the first on
his/her cell phone) before the next turn can begin. The two friends to meet as quickly
as possible.

a) Write a detailed formulation for this search problem.


Let 𝐷(𝑖, 𝑗) be the straight-line distance between cities 𝑖 and 𝑗.
b) Which of the following heuristic functions are admissible? (i) 𝐷(𝑖, 𝑗); (ii) 2 ·
𝐷(𝑖, 𝑗); (iii) 𝐷(𝑖, 𝑗)/2.

Exercise 4 (Adopted from Russel and Norvig): The missionaries and cannibals’
problem is usually stated as follows. Three missionaries and three cannibals are on
one side of a river, along with a boat that can hold one or two people. Find a way
to get everyone to the other side without ever leaving a group of missionaries in one
place outnumbered by the cannibals in that place.

a) Formulate the problem precisely, making only those distinctions necessary to


ensure a valid solution. Draw a diagram of the complete state space.

b) Implement and solve the problem optimally using an appropriate search


algorithm. Is it a good idea to check for repeated states?
Exercise 5: Figure below shows some important cities in the map of India. The
distances between the connected cities via road are measured as the cost function
and the straight-line aerial distance is used as the heuristic function

a) Draw the BFS and DFS trees to reach Kozhikode from New Delhi.
List the order of nodes visited for each case (BFS and DFS)
b) Use the UCS algorithm to find the shortest distance from New Delhi to
Kozhikode Show the order of nodes visited.
c) List the path obtained and the distance from the source to destination for
each algorithm (BFS, DFS and UCS).

Page 2
d) Given the straight-line distance (heuristic) to New Delhi from each city,
find the path obtained using A* and the greedy best fit search algorithm.

Exercise 6 (Adopted from Russel and Norvig): Consider the map below. Two friends
(P and E) want to avoid each other. The problem then becomes a two-player
pursuit–evasion game. We assume now that the players take turns moving. The
game ends only when the players are on the same node; the terminal payoff to the
pursuer is minus the total time taken. (The evader “wins” by never losing.)

Page 3
a) Construct the game tree and mark the value of terminal nodes
b) Apply alpha-beta pruning on the game tree assuming that the tree is
evaluated from left to right
c) Can you prove anything in general about who wins the game on a map that
is a tree?

Exercise 7 (Adopted from Russel and Norvig): Consider the tic-tac-toe game with n
rows and columns. Define 𝑋𝑛 as the number of rows, columns, or diagonals with
exactly n X’s and no O’s. Similarly, 𝑂𝑛 is the number of rows, columns, or diagonal
with just n O’s. The utility function assigns +1 to any position with 𝑋3 = 1 and -1 to any
position with 𝑂3 = 1 . All other terminal positions have utility 0. For non-terminal
positions we use a linear evaluation function defined as 𝐸𝑣𝑎𝑙(𝑠) = 3 𝑋2 (𝑠) + 𝑋1 (𝑠) −
(3 𝑂2 (𝑠) + 𝑂1 (𝑠)).

a) Show the whole game tree starting from an empty board down to depth 2,
taking symmetry into account
b) Mark on your tree the evaluations for all the positions at depth 2.
c) Using the minimax algorithm, mark on your tree the backed-up values for the
position at depths 1 and 0, and use these values to choose the best starting move.
d) Circle the nodes at depth 2 that would not be evaluated if alpha-beta
pruning were applied, assuming the nodes are generated in the optimal order for
alpha-beta pruning.

Page 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy