1-Search_soln

1-Search_soln - CS188: Artificial Intelligence, Fall 2008...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS188: Artificial Intelligence, Fall 2008 Written Assignment 1 CS188 Fall 2010Due: September 11th at the beginning of lecture Section 1: Search 11 Search Search Strategies Graph algorithms in action A h=2 Goal 2 2 4 Start C h=2 5 5 1 3 B h=5 D h=1 4 Our intrepid hero, Search Agent, is late for her artificial intelligence class and states get there fast! The For each of the following graph search strategies, work out the order in whichneeds toare expanded, as well graph above represents graph search. In all cases, assume ties resolve different parts of campus. For earlier as the path returned by how long it takes Search Agent to walk betweenin such a way that states with each of the following graph search strategies, work out the order in which states are expanded, well as the path alphabetical order are expanded first. The start and goal state are S and G, respectively.asRemember that in returned by a state is expanded only assume ties resolve in such a way that states with earlier alphabetical graph search, graph search. In all cases,once. order are expanded first. The start and goal state are S and G, respectively. Remember that in graph search, a state is expanded only once. (a) Depth-first search. a) Expanded: Search StatesDepth-First Start, A, C, D, B, Goal Path Returned: Start-A-C-D-Goal b) Breadth First Search (b) Breadth-first search. States Expanded: Start, A, B, D, C, Goal Path Returned: Start-D-Goal c) Uniform-Cost Search (c) Uniform cost search. States Greedy search with the heuristic values listed at each state. d) Expanded: Start, A, B, D, C, Goal Path Returned: Start-A-C-Goal e) A∗ search with the the heuristic h listed on the state. (d) Greedy search with heuristic values shown at each graph. States Expanded: Start, D, Goal Path Returned: Start-D-Goal (e) A search with the same heuristic. States Expanded: Start, A, D, B, C, Goal Path Returned: Start-A-C-Goal 1 2 n-Queens Max Friedrich William Bezzel invented the eight queens puzzle in 1848: place 8 queens on a chess board such that none of them can capture any other. The problem, and the generalized version with n queens, has been studied extensively (a Google Scholar search turns up over 3500 papers on the subject). Queens can move any number of squares along rows, columns, and diagonals (left); An example solution to the 4-queens problem (right). a) Formulate n-queens as a search problem, using the following state-space representation of: a set of boards, in which each space on the board may or may not contain a queen. Start State: An empty board Successor Function: Return all boards with one more queen placed anywhere Goal Test: Returns True iff n queens are on the board such that no two can attack each other b) 2 How large is the state space in your formulation? 2n , or 18, 446, 744, 073, 709, 551, 616 for 8-queens. c) One way to limit the size of your state space is to limit what your successor function returns. Reformulate your successor function to reduce the effective state-space size. The successor function is limited to return legal boards. Then, the goal test need only check if the board has n queens. d) How large is the state space in your formulation with an efficient successor function? There are n2 choices for the first queen, n2 − 1 choices for the second queen, and so on. But, order doesnt matter. So we have n2 ! (n2 −n)!n! . Thats 4,426,165,368 possible boards for the 8-queens problem. e) Give a more efficient state space representation. How large is the state space, with and without an efficient successor function? A more effective representation is to have a fixed ordering of queens, such that the queen in the first column is placed first, the queen in the second column is placed second, etc. The representation could be a n-length vector, in each each entry takes a value 1-n, or “null”. Without an efficient successor function, we have n choices for each queen, so the total state space is nn (16, 777, 216 with 8-queens). Using an efficient successor function, for the first queen, we have n choices, for the second we have n − 1, etc, so the total state space is n! (40, 320 for 8-queens). 2 3 15-puzzle The puzzle involves sliding tiles until they are ordered correctly. To solve these puzzles efficiently with A* search, good heuristics are important. (1) Create a heuristic for the 15-puzzle based on the number of misplaced tiles. Count the number of tiles out of place, not including the blank tile. (2) Create a heuristic using Manhattan distance. Sum the Manhattan (city block) distances between each tile’s current position and its intended position. (3) Explain why your heuristics are admissible. These heuristics are both relaxations of the original rpoblem so the heuristic estimate is always less than or equal to the actual cost of reaching the goal. Note that if you include the blank tile in the estimate, this heuristic is no longer admissible (think about the case where only 1 tile is out of place). 3 ...
View Full Document

Ask a homework question - tutors are online