Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Blind State-Space Search Notes for Ch.11 of Bratko For CSCE 580 Sp03 Marco.

Similar presentations


Presentation on theme: "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Blind State-Space Search Notes for Ch.11 of Bratko For CSCE 580 Sp03 Marco."— Presentation transcript:

1 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Blind State-Space Search Notes for Ch.11 of Bratko For CSCE 580 Sp03 Marco Valtorta

2 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering State-Space Search Formulation of Problem Solving Initial state –a distinguished node in a directed graph Goal state(s) –a (set of) distinguished nodes in a directed graph sometimes represented implicitly as a predicate Possible actions (moves) –edges (arcs) in a directed graph usually represented by a successor function

3 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering State-Space Search Problem Solution A path in the directed graph representing the problem –shortest –cheapest (least-cost) Examples (puzzles and practical problems): –block rearrangement (figs.11.1 and 11.2) –traveling salesman –towers of Hanoi –eight puzzle (fig. 11.3) –farmer, wolf, cabbage –eight queens –VLSI placement –other examples: see Ch.3 of Russell and Norvig

4 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Block Rearrangement: Details state: a list of the three stacks on the table: e.g., [[c,a,b],[ ],[ ]]---top block is head of list three goal states: [[a,b,c],[],[]], [[],[a,b,c],[]], [[],[],[a,b,c]]---a on top moves (of equal cost; s for successor): s(Stacks,[Stack1,[Top|Stack2]|OtherStacks]) :- del([Top1|Stack1],Stacks,Stacks1), del(Stack2,Stacks1,OtherStacks). goal condition: goal(Situation) :- member([a,b,c],Situation). initial state is Start in solve( Start,Solution).

5 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Depth-first Search To find a solution path, Sol, from a given node N to some goal node, –if N is a goal node, then Sol = [N] –if there is a successor node, N1, of N, such that there is a path Sol1 from N to a goal node, then Sol = [ N | Sol1]. solve( N,[N]) :- goal( N). solve( N,[ N|Sol1]) :- s( N,N1), solve( N1,Sol1). solve is a depth-first program! solve exploits the depth-first order in which Prolog explores goal trees. Example: Figure 11.4

6 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Refinement of DFS Cycle detection –fig11_7.pl (add parentheses for nots!) depth-limited depth-first search –fig11_8.pl iterative-deepening depth-first search –ch11_1.pl

7 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Breadth-First Search To do BFS when given a set of candidate path: If the head of the first path is a goal node, then this path is a solution, else Remove the first path from the candidate set and generate the set of one-step extensions of this path, add this set of extensions at the end of the candidate set, and execute BFS on this updated set.

8 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering BFS Programs fig11_10.pl Basic program fig11_11.pl Uses difference lists for open list management

9 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Complexity of Blind Search Procedures See Table 11.1 See Ch.3 [Russell and Norvig] Discusses Dijkstra’s shortest path algorithm also Dijkstra’s algorithm is optimal among admissible blind unidirectional algorithms, according to the measure “number of node expansions.” The implementation of Dijkstra’s algorithm that uses heaps is optimal in the decision tree model (Kingston) IDDFS is, in practice, best, because of the enormous savings in space.

10 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Lower Bound for Dijkstra’s Algorithm A simple adversary argument shows that any algorithm for shortest paths must examine all edges of a graph (in the worst case): Ω (n+m) lower bound It is possible to transform (in linear time) sorting to shortest paths, and transform the result back to sorting: Ω (n log n) lower bound in the decision tree model The implementation of Dijkstra’s algorithm that uses Fibonacci heaps (for the priority queue) achieves the Ω (m + nlogn) lower bound To improve, either Go outside the decision tree model (e.g., use radix sorting for the priority queue) Use an algorithm that cannot generate the sequence of expanded nodes in non-decreasing order from the start node (e.g., use bi- directional search)


Download ppt "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Blind State-Space Search Notes for Ch.11 of Bratko For CSCE 580 Sp03 Marco."

Similar presentations


Ads by Google