# TRƯỜNG ĐẠI HỌC BÁCH KHOA TP.

HCM Khoa Khoa học & Kỹ thuật Máy tính

ARTIFICIAL INTELLIGENCE
Tutorial 2 Questions PROBLEMS & SEARCH
Question 1. State Space Search

For each of the following problems, specify (i) a representation for a state; (ii) the start and goal states and (iii) set of rules, each of which is followed by an example. Example problem: The water-jug problem in the lecture notes. State representation: a pair (x,y) where x and y are respectively the amounts of water in 4-litre and 3-litre jugs. Start state: (0,0) Goal state: (2,n) 0<=n<=3 Set of rules: - Fill up the first jug: (2,2)  (4,2) - Fill up the second jug: (2,2)  (2,3) - Empty the first jug: (2,2)  (0,2) - Empty the second jug: (2,2)  (2,0) - Fill up the first jug by the water in the second one: (2,3)  (4,1) - Fill up the second jug by the water in the first one: (2,1)  (0,3) - Empty the first jug to the second one: (1,1)  (0,2) - Empty the second jug to the first one: (2,1)  (3,0) a) The 8-puzzle problem: The 8-puzzle is a small board game for a single player; it consists of 8 square tiles numbered 1 through 8 and one blank space on a 3 x 3 board, as depicted in left board in Figure 1. Moves of the puzzle are made by sliding an adjacent tile into the position occupied by the blank space, which has the effect of exchanging the positions of the tile and blank space. Only tiles that are horizontally or vertically adjacent (not diagonally adjacent) may be moved into the blank space. The object is to reach the configuration in the right board of Figure 1.

1

TRƯỜNG ĐẠI HỌC BÁCH KHOA TP.HCM Khoa Khoa học & Kỹ thuật Máy tính

Figure 1 – An instance of the 8-puzzle problem Give all states that can be generated from the left board in Figure 2. b) The 8-queens problem: The eight queens puzzle is the problem of putting eight chess queens on an 8×8 chessboard such that none of them is able to capture any other using the standard chess queen's moves. Figure 3 depicts one solution.

Figure 2 – An example solution for the 8-queens problem c) Touring problems: Visit every city in Figure 3 at least once, starting, and ending in Bucharest

2

TRƯỜNG ĐẠI HỌC BÁCH KHOA TP.HCM Khoa Khoa học & Kỹ thuật Máy tính

Figure 3: A road map of Romania d) Robot navigation problem: Robot navigation means its ability to determine its own position in its frame of reference and then to plan a path towards some goal location. In order to navigate in its environment, the robot or any another mobility device requires representation i.e. a map of the environment and the ability to interpret that representation. In this problem, we will deal with a situation in which the robot has to go from start to goal position in the room full of obstacles. In this situation, some works that we have to do. One of them is path finding, and how can the robot know which way to go. This problem can be mapped into problem of finding path from point S to point G and this path must not cut over polygons between S and G (figure 4).

3

TRƯỜNG ĐẠI HỌC BÁCH KHOA TP.HCM Khoa Khoa học & Kỹ thuật Máy tính

Figure 4: Finding path from point S to point G Question 2. Analyze each of four problems in Question 1 with respect to the seven problem characteristics discussed in Chapter 2. Question 3.

Uninformed search - DFS and BFS

After formalizing problems (defined state space, initial states, goal states and rules), we have to apply search strategies to go from initial state to goal state. The search graph will have start node as the initial state. The edges are actions and the nodes correspond to states in the state space of the problem. The search process finds possible action sequences starting at the start node of search graph to goal state (end node). In the problem of question 1c, find a solution using Depth-First-Search and BreadthFirst-Search. Assume that when performing the BFS traversal, the cities will be considered in counter-alphabetical order when in the same level. -- End --

4