Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 1 State-Space Search Motivation: Understanding “dynamics” in AI Statics versus Dynamics of AI Statics:

Similar presentations


Presentation on theme: "CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 1 State-Space Search Motivation: Understanding “dynamics” in AI Statics versus Dynamics of AI Statics:"— Presentation transcript:

1 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 1 State-Space Search Motivation: Understanding “dynamics” in AI Statics versus Dynamics of AI Statics: Knowledge representation Dynamics: Inference State-Space Search is the primary inference paradigm of GOFAI (good old-fashioned artificial intelligence -- pre- statistical AI)

2 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 2 Outline: Origins of State-Space Search: GPS A Puzzle: The “Painted Squares” Combinatorics of the Puzzle Demonstration with T* State spaces, operators, moves Representations for pieces, boards, and states. Recursive depth-first search Iterative depth-first search Graph search problems Uniform cost alg. Heuristic search with A-Star.

3 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 3 Allen Newell and Herbert Simon The state-space search paradigm received early attention from Newell and Simon, who developed a system called GPS (the General Problem Solver) in 1960. Allen Newell http://diva.library.cmu.edu/Newell/ Herbert Simon http://nobelprize.org/nobel_prizes/economics/laureates/1978/simon-autobio.html

4 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 4 The Painted Squares Puzzle(s) A Painted Squares Puzzle consists of 1. a board (typically of size 2 by 2), and 2. a set of painted squares. Each square has its sides painted with a texture that is one of: striped, hashed, gray, or boxed. The objective is to fill the board with the square pieces in such a way that adjacent squares have matching textures where their sides abut one another.

5 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 5 Painted Squares: The Pieces

6 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 6 Painted Squares: The Board

7 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 7 Painted Squares: Initial State

8 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 8

9 9 Painted Squares How many possible arrangements? Could we simply make a list of all the possible arrangements of pieces, and then select those that are solutions? It depends on how many there are and how much time we can afford to spend.

10 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 10 Painted Squares How many possible arrangements? Factors to consider: 1.Number of places on the board 2.Number of possible textures in the patterns 3.Number of rotations of a square (usually 4) 4.Whether flipping squares is allowed 5.Symmetries of pieces 6.Symmetries of the board 7.All possible board shapes for a given side (e.g. the possible “quadraminos”) 8.Full boards only, or partially filled boards, too?

11 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 11 Painted Squares How many possible arrangements? The number can be reduced by enforcing constraints: 1.Do not permit violations of the matching-sides criterion. 2.Require that filled positions on the board be contiguous and always the first k in some ordering.

12 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 12 A Solution Approach for the Painted Squares Puzzle state: partially filled board. Initial state: empty board. Goal state: filled board, in which pieces satisfy all constraints. Operator: for a given remaining piece, given vacancy on the board, and given orientation, try placing that piece at that position in that orientation.

13 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 13 Interactive Search T* = T-STAR = Transparent STate-space search ARchitecture Missionaries and Cannibals puzzle Image processing operator sequences Blocks-World problem (robot motion planning)

14 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 14 State-Space Search General terminology …

15 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 15 States A state consists of a complete description or snapshot of a situation arrived at during the solution of a problem. Initial state: the starting position or arrangement, prior to any problem-solving actions being taken. Goal state: the final arrangement of elements or pieces that satisfies the requirements for a solution to the problem.

16 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 16 State Space The set of all possible states – the arrangements of the elements or components to be used in solving a problem – forms the space of states for the problem. This is known as the state space.

17 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 17 Moves A move is a transition from one state to another. An operator is a partial function (from states to states) that can (sometimes) be applied to a state to produce a new state, and also, implicitly, a move. A sequence of moves that leads from the initial state to a goal state constitutes a solution.

18 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 18 Operator Preconditions Precondition: A necessary property of a state in which a particular operator can be applied. Example: In checkers, a piece may only move into a square that is vacant. Vacant(place) is a precondition on moving a piece into place. Example: In Chess, a precondition for moving a rook from square A to square B is that all squares between A and B be vacant. (A and B must also be either in the same row or the same column.)

19 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 19 Search Trees By applying operators from a given state we generate its children or successors. Successors are descendants as are successors of descendants. If we ignore possible equivalent states among descendants, we get a tree structure. Depth-First Search: Examine the nodes of the tree by fully exploring the descendants of a node before trying any siblings of a node.

20 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 20 The Combinatorial Explosion Suppose a search process begins with the initial state. Then it considers each of k possible moves. Each of those may have k possible subsequent moves. In order to look n steps ahead, the number of states that must be considered is 1 + k + k 2 +... + k n. For k > 1, this expression grows rapidly as n increases. (The growth is exponential.) This is known as the combinatorial explosion.

21 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 21 Graph Search When descendant nodes can be reached with moves via two or more paths, we are really searching a more general graph than a tree. Depth-First Search: Examine the nodes of the graph by fully exploring the “descendants” of a node before trying any “siblings” of a node.

22 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 22 Sample Graph

23 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 23 Depth-First Search: Iterative Formulation 1. Put the start state on a list OPEN 2. If OPEN is empty, output “DONE” and stop. 3. Select the first state on OPEN and call it S. Delete S from OPEN. Put S on CLOSED. If S is a goal state, output its description 4. Generate the list L of successors of S and delete from L those states already appearing on CLOSED. 5. Delete any members of OPEN that occur on L. Insert all members of L at the front of OPEN. 6. Go to Step 2.

24 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 24 Breadth-First Search: Iterative Formulation 1. Put the start state on a list OPEN 2. If OPEN is empty, output “DONE” and stop. 3. Select the first state on OPEN and call it S. Delete S from OPEN. Put S on CLOSED. If S is a goal state, output its description 4. Generate the list L of successors of S and delete from L those states already appearing on CLOSED. 5. Delete any members of OPEN that occur on L. Insert all members of L at the end of OPEN. 6. Go to Step 2.

25 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 25 Search Algorithms Alternative objectives: Reach any goal state Find a short or shortest path to a goal state Alternative properties of the state space and moves: Tree structured vs graph structured, cyclic/acyclic Weighted/unweighted edges Alternative programming paradigms: Recursive Iterative Iterative deepening Genetic algorithms

26 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 26 Recursive DFS for the Painted Squares Puzzle state: partially filled board. Initial state: empty board. Goal state: filled board, in which pieces satisfy all constraints.

27 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 27 Recursive Depth-First Method Current board B  empty board. Remaining pieces Q  all pieces. Call Solve(B, Q). Procedure Solve(board B, set of pieces Q) For each piece P in Q, { For each orientation A { Place P in the first available position of B in orientation A, obtaining B’. If B’ is full and meets all constraints, output B’. If B’ is full and does not meet all constraints, return. Call Solve(B’, Q - {P}). } Return.

28 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 28 State-Space Graphs with Weighted Edges Let S be space of possible states. Let (s i, s j ) be an edge representing a move from s i to s j. w(s i, s j ) is the weight or cost associated with moving from s i to s j. The cost of a path [ (s 1, s 2 ), (s 2, s 3 ),..., (s n-1, s n ) ] is the sum of the weights of its edges. A minimum-cost path P from s 1 to s n has the property that for any other path P’ from s 1 to s n, cost(P)  cost(P’).

29 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 29 Graphs with Weighted Edges

30 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 30 Uniform-Cost Search A more general version of breadth-first search. Processes states in order of increasing path cost from the start state. The list OPEN is maintained as a priority queue. Associated with each state is its current best estimate of its distance from the start state. As a state s i from OPEN is processed, its successors are generated. The tentative distance for a successor s j of state s i is computed by adding w(s i, s j ) to the distance for s i. If s j occurs on OPEN, the smaller of its old and new distances is retained. If s j occurs on CLOSED, and its new distance is smaller than its old distance, then it is taken off of CLOSED, put back on OPEN, but with the new, smaller distance.

31 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 31 Ideal Distances in A* Search Let f(s) represent the cost (distance) of a shortest path that starts at the start state, goes through s, and ends at a goal state. Let g(s) represent the cost of a shortest path from the start state to s. Let h(s) represent the cost of a shortest path from s to a goal state. Then f(s) = g(s) + h(s) During the search, the algorithm generally does not know the true values of these functions.

32 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 32 Estimated Distances in A* Search Let g’(s) be an estimate of g(s) based on the currently known shortest distance from the start state to s. Let the h’(s) be a heuristic evaluation function that estimates the distance (path length) from s to the nearest goal state. Let f’(s) = g’(s) + h’(s) Best-first search using f’(s) as the evaluation function is called A* search.

33 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 33 Admissibility of A* Search Under certain conditions, A* search will always reach a goal state and be able to identify a shortest path to that state as soon as it arrives there. The conditions are: h’(s) must not exceed h(s) for any s. w(s i, s j ) > 0 for all s i and s j. This property of being able to find a shortest path to a goal state is known as the admissibility property of A* search. Sometimes we say that a particular A* algorithm is admissible. We can say this when its h’ function satisfies the underestimation condition and the underlying search problem involves positive weights.

34 CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 34 Search Algorithm Summary Unweighted graphs Weighted graphs blind searchDepth-firstDepth-first Breadth-firstUniform-cost uses heuristicsBest-firstA*


Download ppt "CSE 415 -- (c) S. Tanimoto, 2008 State-Space Search 1 State-Space Search Motivation: Understanding “dynamics” in AI Statics versus Dynamics of AI Statics:"

Similar presentations


Ads by Google