and-or graphs

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

Upload: bryant

Post on 06-Jan-2016

25 views

Category:

Documents


1 download

DESCRIPTION

And-Or Graphs. CSCE 580 Spr03 Instructor: Marco Valtorta Hrishikesh J. Goradia Seang-Chan Ryu. 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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: And-Or Graphs

And-Or Graphs

CSCE 580 Spr03

Instructor: Marco Valtorta

Hrishikesh J. Goradia

Seang-Chan Ryu

Page 2: And-Or Graphs

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

Page 3: And-Or Graphs

And-Or Graphs

Difference between state-state representation and and or representation.

solution: path vs. tree

Page 4: And-Or Graphs

Search in and-or graphs

a

b c

e

h i

d gf

Page 5: And-Or Graphs

Search in and-or graphs

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 cyclea :- b.a :- c.b :- d, e.e :- h.c :- f, g.f :- h, i.d.g.h.

Page 6: And-Or Graphs

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).

Page 7: And-Or Graphs

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).

Page 8: And-Or Graphs

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.

Page 9: And-Or Graphs

Tic-tac-toe game

Max size of the state space for a complete solution = 9!

Page 10: And-Or Graphs

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!

Page 11: And-Or Graphs

Tic-tac-toe game

The winning positions (shown in red) are the goal states. tictactoe.pl shows the complete Prolog code for our problem.

Page 12: And-Or Graphs

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