Docsity

Artificial Intelligence Homework Set 2: Search Trees and Puzzle Solutions, Assignments of Computer Science

Toggle sidebar
bg1
CPSC 5185 Introduction to Artificial Intelligence
Homework Set 2 Due Thursday, September 29, 2005
1. This problem asks you to examine an instance of the 8–puzzle (see page 65 of the text)
and to draw a search tree for the solution. Here is the problem instance.
a) How many moves are legal for the first move?
b) How many numbers are “out of place” in the sense that they must be moved to
attain the goal state?
c) Draw the complete search tree, down to a level at which a solution is found.
Note that this can be done in two moves, so that the tree has the root and two
levels. Please try to be neat.
ANSWER:
a) There are four legal moves for the blank in the center. See the search tree below.
b) The “1” and “4” are out of place and others are in place. Two numbers out of place.
c) Here is the search tree, complete to the first level.
pf3
pf4

Partial preview of the text

Download Artificial Intelligence Homework Set 2: Search Trees and Puzzle Solutions and more Assignments Computer Science in PDF only on Docsity!

CPSC 5185 Introduction to Artificial Intelligence

Homework Set 2 Due Thursday, September 29, 2005

  1. This problem asks you to examine an instance of the 8–puzzle (see page 65 of the text) and to draw a search tree for the solution. Here is the problem instance. a) How many moves are legal for the first move? b) How many numbers are “out of place” in the sense that they must be moved to attain the goal state? c) Draw the complete search tree, down to a level at which a solution is found. Note that this can be done in two moves, so that the tree has the root and two levels. Please try to be neat. ANSWER: a) There are four legal moves for the blank in the center. See the search tree below. b) The “1” and “4” are out of place and others are in place. Two numbers out of place. c) Here is the search tree, complete to the first level.

We here note the correct move to complete the game and ignore the others.

  1. (Similar to 3.9 on page 90) The missionaries and cannibals problem is usually stated as follows. Three missionaries and three cannibals are on one side of the river, along with a boat that can hold at most two people. Find a way to get everyone from one side of the river to the other side of the river, without leaving any group of missionaries (on either side of the river or in the boat) outnumbered by the cannibals in that place. a) Devise a way to describe the states of the puzzle and the moves between the states. Note that it is not necessary to consider times in which people are in the boat and in transit across the river. Describe the banks as “left bank” and “right bank”. ANSWER: Here is one way to describe the state. b) In terms of these descriptions, specify the start and final state. ANSWER: The start state is on the left, the final state on the right.
  1. Any solution to the eight–queens problem can be expressed as a permutation of the integers 1 through 8. One solution is (5, 2, 8, 1, 4, 7, 3, 6). a) Use simple symmetries to generate three other solutions to the problem. Answers: Original: (5, 2, 8, 1, 4, 7, 3, 6) Flip horizontal: (6, 3, 7, 3, 1, 8, 2, 5) Vertical: (4, 7, 1, 8, 5, 2, 6, 3) (3, 6, 2, 5, 8, 1, 7, 4)
  2. Do a web search on the eight–queens problem. Find two solutions to the problem that are distinct from the solutions discussed in the previous problem.
  3. A rook is a chess piece that can move only on straight lines (along rows and columns) but not along diagonals. How many solutions exist to the eight–rooks problem? You can get this problem by simple mathematics, with no search trees drawn. ANSWER: 8! = 40320. The first rook can go in any one of 8 rows, the second in any of 7 rows, etc. There are no diagonal constraints to worry about, so we have 8! = 40320 solutions.