Managing Search General Game PlayingLecture 5 Michael Genesereth / Nat Love Spring 2006.

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Uninformed search strategies
Lecture 3: Uninformed Search
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Problem-solving as search. History Problem-solving as search – early insight of AI. Newell and Simon’s theory of human intelligence and problem-solving.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Blind Search by Prof. Jean-Claude Latombe
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.
Lets remember about Goal formulation, Problem formulation and Types of Problem. OBJECTIVE OF TODAY’S LECTURE Today we will discus how to find a solution.
Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
Using Search in Problem Solving
UnInformed Search What to do when you don’t know anything.
Artificial Intelligence Chapter 3: Solving Problems by Searching
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2004.
Using Search in Problem Solving
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Incomplete Information General Game PlayingLecture 5 Michael Genesereth Spring 2005.
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Using Search in Problem Solving
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2002.
Solving problems by searching
Metagaming General Game PlayingLecture 5 Michael Genesereth Spring 2012.
Solving Problems by Searching
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Lecture 2-2CS250: Intro to AI/Lisp Implementing Search Lecture 2-2 January 14 th /19 th, 1999 CS250.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2.
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Uninformed Search Methods
Implementation: General Tree Search
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
Solving problems by searching A I C h a p t e r 3.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
State Space Search and Planning General Game PlayingLecture 4 Michael Genesereth Spring 2005.
Blind Search Russell and Norvig: Chapter 3, Sections 3.4 – 3.6 CS121 – Winter 2003.
Romania. Romania Problem Initial state: Arad Goal state: Bucharest Operators: From any node, you can visit any connected node. Operator cost, the.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Chapter 3 (Part-II) Section 3.4, 3.5, 3.6 Uninformed Search.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
What to do when you don’t know anything know nothing
Searching for Solutions
Search Exercise Search Tree? Solution (Breadth First Search)?
Problem Spaces & Search
Artificial Intelligence Chapter 8 Uninformed Search
Problem Spaces & Search
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Basic Search Methods How to solve the control problem in production-rule systems? Basic techniques to find paths through state- nets. For the moment: -
Presentation transcript:

Managing Search General Game PlayingLecture 5 Michael Genesereth / Nat Love Spring 2006

2 Game Tree Search X OX O X OX OX X OX OX O X OX OX O X X OX OX O X X OX OX O X 100 X OX O X X OX O X X OX O X X OX O X

3 Resource Limitations Large state spaces ~5000 states in Tic-Tac-Toe ~10 30 states in Chess Even larger game trees ~900,000 nodes in Tic-Tac-Toe Limited Resources Memory Time (start clock, move clock)

4 Managing Search Search Direction Search Strategy Incremental Game Tree Search Game Graph Search

5 Search Direction

6 Forward Search f j k c d a e g m b l n h i

7 Backward Search f j k c d n e g b b a c h i

8 Bidirectional Search m a

9 Search Strategy

10 Depth First Search a c hg d ji b fe a b e f c g h d i j Advantage: Small intermediate storage Disadvantage: Susceptible to garden paths Disadvantage: Susceptible to infinite loops

11 Breadth First Search a b c d e f g h i j a c hg d ji b fe Advantage: Finds shortest path Disadvantage: Consumes large amount of space

12 Time Comparison Branching 2 and depth d and solution at depth k

13 Time Comparison Analysis for branching b and depth d and solution at depth k.

14 Space Comparison Total depth d and solution depth k.

15 Iterative Deepening Run depth-limited search repeatedly, starting with a small initial depth, incrementing on each iteration, until success or run out of alternatives.

16 Example a c hg d ji b fe a a b c d a b e f c g h d i j Advantage: Small intermediate storage Advantage: Finds shortest path Advantage: Not susceptible to garden paths Advantage: Not susceptible to infinite loops

17 Time Comparison

18 General Results Theorem [Korf]: The cost of iterative deepening search is b/(b-1) times the cost of depth-first search (where b is the branching factor). Theorem: The space cost of iterative deepening is no greater than the space cost for depth-first search.

19 Incremental Game Tree Search

20 Game Tree Search Problem: The clock may be too short to permit complete search on a single move. Approach: Incremental Tree Search

21 Incremental Game Graph Search

22 Nodes Versus States The game tree for Tic-Tac-Toe has approximately 900,000 nodes. There are approximately 5,000 distinct states. Searching the tree requires 180 times more work than searching the graph. One small hitch: The graph is implicit in the state description and must be built in advance or incrementally. Recognizing a repeated state takes time that varies with the size of the graph thus far seen. Solution: Hashing.

23 Single Player Game Graph s3 s1 s2 s4

24 Multiple Player Game Graph s3 s1 s2 s4 aa bb ba ab

25 Bipartite Game Graph s3 s1 a b s2 s4 aa bb ba ab

26 Bipartite Association List Simple Association List ((a. s2) (b. s3)) Bipartite Association List: ((a. (((a a). s2) ((a b). s1))) (b. (((b a). s3) ((b b). s4))))

27 Incremental Tree Search Code

28 Players class player (thing) {var match  nil; var role  nil; var roles  nil; var theory  nil; var startclock  0; var playclock  0 var hasher  nil; var action  nil; var root  nil; var fringe  nil}

29 Tree Expansion function expands (player,count) {var node; for i  1 until i > count or null(player.fringe) do {node  first(player.fringe); player.fringe  rest(player.fringe); unless numberp(node.score) i  i + 1; player.fringe  nconc(player.fringe,expand(node))}; return done }

30 Nodes class node (thing) {var player  nil; var data  nil; var theory  nil; var parent  nil; var alist  nil; var score  nil}

31 Single Player Node Expansion function expand (node) {var match  node.match; var role  match.role; var old; var data; var al; var nl; for a in legals(role,node) {old  node.data; node.data  cons( does( role,a), old); data  simulate(node); node.data  old; new  makenode(match, data, node.theory, node) if termp(new) then new.score  reward(role, new); nl  cons(new, nl); al  acons(a, new, al)} node.alist  nreverse(al) return nreverse(nl)}

32 Multiple Player Node Expansion function expand (node) {var match  node.match; var role  match.role; var old; var data; var al; var nl; for a in legals(role,node) {for j in joints(role, a, player.roles, node, nil, nil) {old  node.data; node.data  consactions(match.roles, j, old); data  simulate(node); node.data  old; new  makenode(match, data, node.theory, node) if termp(new) then new.score  reward(role, new); nl  cons(new, nl); bl  acons(j, new, bl)} al  acons(a, nreverse(bl), al)} node.alist  nreverse(al); return nreverse(nl)}

33 Multiple Player Node Expansion function expand (node) {var match  node.match; var role  match.role; var old; var data; var al; var nl; for a in legals(role,node) {for j in joints(role, a, player.roles, node, nil, nil) {old  node.data; node.data  consactions(match.roles, j, old); data  simulate(node); node.data  old; new  makenode(match, data, node.theory, node) if termp(new) then new.score  reward(role, new); nl  cons(new, nl); bl  acons(j, new, bl)} al  acons(a, nreverse(bl), al)} node.alist  nreverse(al); return nreverse(nl)}

34 Subroutines function consactions (roles, actions, data) {var nl; for role in roles, action in actions nl  cons(does(role,action), nl) return nreverse(nl)} function joints (role, action, roles, node, xl, nl) {if null(roles) then cons(reverse(xl),nl) else if car(roles) = role then joints(role,action,cdr(roles),node,cons(action,xl),nl) else for x in legals(car(roles),node) nl  joints(role,action,cdr(roles),node, cons(x,xl),nl) return nl}

35 Best Move function bestmove (node) {var best; var score; for pair in node.alist do {score  maxscore(pair.right); if score = 100 then return pair.left; else if score = 0; else if null(best) then best  pair.left} return best or car(node.alist).left}

36 Node Evaluation function maxscore (node) {var score  nil; var max  0; if node.score then node.score; else if null(node.alist) then nil; else for pair in node.alist do {score  minscores(pair.right) if score = 100 then return 100 else if not numberp(score) then max  nil else if null(max) else if score > max then max  score} return max}

37 Node Evaluation function maxscore (node) {var score  nil; var max  0; if node.score then node.score; else if null(node.alist) then nil; else for pair in node.alist do {score  minscores(pair.right) if score = 100 then return 100 else if not numberp(score) then max  nil else if null(max) else if score > max then max  score} return max}

38 Node Evaluation function minscores (al) {var score  nil; var min  100; for pair in al do {score  maxscore(pair.right) if score = 0 then return 0 else if not numberp(score) then min  nil else if null(min) else if score < min then min  score} return min}

39 Graph Search Code

40 Node Expansion function expand (node) {var player  node.player; var old; var data; var al; var nl; for a in legals(role,node) {for j in joints(player.role, a, player.roles, node, nil, nil) {old  node.data; node.data  consactions(player.roles, j, old); data  sort(simulate(node)); node.data  old; if new  gethash(data,player.hasher) then new else {new  makenode(player, data, node.theory, node) gethash(data, player.hasher)  new; if termp(new) then new.score  reward(player.role, new); nl  cons(new, nl)}; bl  acons(j, new, bl)} al  acons(a, nreverse(bl), al)} node.alist  nreverse(al) return nreverse(nl)}

41 Node Expansion With State Collapse function expand (node) {var match  node.match; var old; var data; var al; var nl; for a in legals(role,node) {for j in joints(match.role, a, match.roles, node, nil, nil) {old  node.data; node.data  consactions(match.roles, j, old); data  sort(simulate(node),minlessp); node.data  old; if new  gethash(data, match.hasher) then new else {new  makenode(match, data, node.theory, node) gethash(data, match.hasher)  new; if termp(new) then new.score  reward(match.role, new); nl  cons(new, nl)}; bl  acons(j, new, bl)} al  acons(a, nreverse(bl), al)} node.alist  nreverse(al) return nreverse(nl)}

42 Ordering Code function minlessp (x,y) {if numberp(x) then {if numberp(y) then x<y else true } else if symbolp(x) then {if numberp(y) then nil else if symbolp(y) then x.name<y.name else true } else if numberp(y) then nil else if symbolp(y) then nil else for l  x then cdr(l) for m  y then cdr(m) do {if null(l) then return not null(m) else if null(m) then return nil else if minlessp(car(l),car(m)) then return true else if car(l)=car(m) then nil else return nil }}

43