Download presentation

Presentation is loading. Please wait.

Published byIsmael Chisnell Modified about 1 year ago

1
And-Or Graphs CSCE 580 Spr03 Instructor: Marco Valtorta Hrishikesh J. Goradia Seang-Chan Ryu

2
And-Or Graphs Technique for solving problems that can be decomposed into sub problems Links between nodes indicates relations between problems Or node: one of its successor node has to be solved And node: all of its successor node has to be solved Problem can be specified by two thinks: start node, goal nodes. Goal nodes: trivial (or primitive) problems Cost can be attached to arcs or nodes

3
And-Or Graphs Difference between state-state representation and and or representation. solution: path vs. tree

4
Search in and-or graphs a b c e hi dgf

5
Use Prolog’s own search mechanism –Only get answer yes or no not solution graph. –Hard to extend to use cost as well –Infinite loop if there is a cycle a :- b. a :- c. b :- d, e. e :- h. c :- f, g. f :- h, i. d. g. h.

6
Search in and-or graphs Other representation :- op (600, xfx, --->). :- op (500, xfx, :). a ---> or : [b,c]. b ---> and : [d,e]. c ---> and : [f,g]. e ---> or : [h]. f ---> or : [h,i]. goal( d). goal( g). goal( h).

7
Search in and-or graphs Depth first search. Modification of depth first search (restricting with maximum depth) – andor.pl Iterative deepening. (increase the maximum depth as the search goes along).

8
Applying and-or graphs Adversarial situations, such as game playing, can often be represented as and-or trees –Nodes represent the situation –Arcs represent possible actions for each player –Each path represents the sequence of choices made alternately by the two opponents In the case of game trees, one is interested in a winning strategy.

9
Tic-tac-toe game Max size of the state space for a complete solution = 9!

10
Tic-tac-toe game For pragmatic reasons, we will consider a subset of the tic-tac-toe problem. The adjacent figure shows the initial state of our tic-tac-toe program. Max. state space for our new problem = 4!

11
Tic-tac-toe game The winning positions (shown in red) are the goal states. tictactoe.pl shows the complete Prolog code for our problem. tictactoe.pl

12
Final comments… For use in real-world applications, the AND-OR graphs technique computes the best state instead of a complete path to the terminal state. These graphs use minmax search and are called game trees. The AND-OR technique for searching can be easily extended to accommodate cost in the graph problems

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google