All rights reservedL. Manevitz Lecture 31 Artificial Intelligence A/O* and Minimax L. Manevitz.

Slides:



Advertisements
Similar presentations
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Advertisements

Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Games & Adversarial Search
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
1 CSC 550: Introduction to Artificial Intelligence Fall 2008 search in game playing  zero-sum games  game trees, minimax principle  alpha-beta pruning.
Artificial Intelligence
Game Playing Games require different search procedures. Basically they are based on generate and test philosophy. At one end, generator generates entire.
CS 484 – Artificial Intelligence
Search in AI.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
Mahgul Gulzai Moomal Umer Rabail Hafeez
This time: Outline Game playing The minimax algorithm
Lecture 02 – Part C Game Playing: Adversarial Search
Game Playing CSC361 AI CSC361: Game Playing.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
Find a Path s A D B E C F G Heuristically Informed Methods  Which node do I expand next?  What information can I use to guide this.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
Lecture 5 Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
Minimax.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
AD FOR GAMES Lecture 4. M INIMAX AND A LPHA -B ETA R EDUCTION Borrows from Spring 2006 CS 440 Lecture Slides.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
1 Computer Group Engineering Department University of Science and Culture S. H. Davarpanah
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Problem Reduction Search: AND/OR Graphs & Game Trees Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Problem Reduction & Game Playing Lecture Module 7.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Game-playing AIs Part 2 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part II  The Minimax Rule  Alpha-Beta Pruning  Game-playing.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Game Playing: Adversarial Search chapter 5. Game Playing: Adversarial Search  Introduction  So far, in problem solving, single agent search  The machine.
Adversarial Search 2 (Game Playing)
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Adversarial Search In this lecture, we introduce a new search scenario: game playing 1.two players, 2.zero-sum game, (win-lose, lose-win, draw) 3.perfect.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab A I (Artificial Intelligence) Professor I. J. Chung.
Adversarial Search and Game-Playing
Last time: search strategies
Iterative Deepening A*
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Games & Adversarial Search
Artificial Intelligence Chapter 12 Adversarial Search
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Games & Adversarial Search
Games & Adversarial Search
NIM - a two person game n objects are in one pile
The Alpha-Beta Procedure
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Mini-Max search Alpha-Beta pruning General concerns on games
Based on slides by: Rob Powers Ian Gent
Artificial Intelligence
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Presentation transcript:

All rights reservedL. Manevitz Lecture 31 Artificial Intelligence A/O* and Minimax L. Manevitz

All rights reservedL. Manevitz Lecture 32 Goals AO* Game Playing Algorithm : –Mini-max. –Mini-max with . –References: Slides follow development in Nilsson; material is in Rich, Nilsson, or Winston.

All rights reservedL. Manevitz Lecture 33 A/O* algorithm Data Structure –Graph –Marked Connectors (down; unlike A*) –Costs q() maintained on nodes –SOLVED markings –Note: We’ll discuss on acyclic graphs.

All rights reservedL. Manevitz Lecture 34 AND Connector Or Connector

All rights reservedL. Manevitz Lecture 35 And/OR Graph

All rights reservedL. Manevitz Lecture 36 Solution Subgraph

All rights reservedL. Manevitz Lecture 37 Solution Subgraph

All rights reservedL. Manevitz Lecture 38 Solution Subgraph G’ of G from n to terminals T If n is in T, G’ is just the singleton n. Otherwise n has one connector to set of nodes n1, n2, …, nk. –There is a Solution graph from each ni to T. –G’ is n, that connector, the nodes n1, …, nk –Plus … the solution graphs from each of the ni.

All rights reservedL. Manevitz Lecture 39 Heuristic Values: estimated cost to solution set

All rights reservedL. Manevitz Lecture 310 Montone Restriction h(n) <= c + h(n1) + h(n2) + … h(nk) Where c is cost of connector between n and set of n1, …, nk. This guarantees that h(n) <= h*(n).

All rights reservedL. Manevitz Lecture 311 Cost (q(n) ) Values If n has no successors q(n) = h (n) Otherwise working from bottom, –q(n) = connector cost + sum of q(successors) Pick smallest of above; and mark direction. If that direction has all successors SOLVED then n is marked SOLVED.

All rights reservedL. Manevitz Lecture 312 Basic Idea of A/O* First top-down graph growing picks out best available partial solution sub-graph from explicit graph. One leaf node of this graph is expanded Second, bottom-up cost-revising, connector-marking, SOLVE-labeling.

All rights reservedL. Manevitz Lecture 313 AO* Algorithm 1.Create G = ; q(s) = h (s) If s  TERM mark s SOLVED 2.Until s labeled SOLVED do: 1.Compute G’ partial solution subgraph of G by tracing down marked connectors in G from s. 2.Select n in G’, n not in TERM, n a leaf. 3.Expand n, place successors in G, for each successor not already in G let q(successor)=h (successor). Label SOLVED all successors in TERM. (If no successors, reset q(n) := infinity ).

All rights reservedL. Manevitz Lecture 314 AO* Algorithm cont. 4.Let S := {n}. 5.Until S =  do : 1.Remove a node, m, from S which has no descendent in G also in S (minimal node). 2.Revise cost for m, (check each connector from m) q(m)=min [c +q(n1)+…+q(nk )]. Mark chosen connector. If all successors their connectors are SOLVED then mark m SOLVED. 3.If m SOLVED or changed q(m) then add to S all “preferred” parents of m. 4.End. 6.End.

All rights reservedL. Manevitz Lecture 315 Tracing the Algorithm

All rights reservedL. Manevitz Lecture 316 Tracing the Algorithm

All rights reservedL. Manevitz Lecture 317 Tracing the Algorithm

All rights reservedL. Manevitz Lecture 318 Tracing the Algorithm

All rights reservedL. Manevitz Lecture 319 Tracing the Algorithm

All rights reservedL. Manevitz Lecture 320 Tracing the Algorithm

All rights reservedL. Manevitz Lecture 321 Optimality of A/O*? If h (n) <= c + h (n1) + … h (nk) for all nodes n and connectors THEN OPTIMAL path. If h(term) = 0 this implies h (n) <= h*(n) (optimistic)

All rights reservedL. Manevitz Lecture 322 Note Acyclicity means that S is empty eventually. Choice of non-terminal node in partial solution graph to expand? –Best with HIGHEST h* (must expand anyhow; quicker to change mind)

All rights reservedL. Manevitz Lecture 323 Game Playing Algorithm What are games ? Notion of Winning Strategy –Von – Neumann Morgernstern Theorem Use of heuristics to pick best move. Look ahead : So use backed up values to choose the best move. Mini-max algorithm.

All rights reservedL. Manevitz Lecture 324 Maximilian vs. Minerva Winning Strategy (7,Min) (6,1,Max)(5,2,Max)(4,3,Max) (4,2,1,Min)(3,2,2,Min)(3,3,1,Min)(5,1,1,Min) (4,1,1,1,Max)(3,2,1,1,Max)(2,2,2,1,Max) (3,1,1,1,1,Min)(2,2,1,1,1,Min) (2,1,1,1,1,1,Max)

All rights reservedL. Manevitz Lecture 325 Maximilian vs. Minerva (7,Min) (6,1,Max)(5,2,Max)(4,3,Max) (4,2,1,Min)(3,2,2,Min)(3,3,1,Min)(5,1,1,Min) (4,1,1,1,Max)(3,2,1,1,Max)(2,2,2,1,Max) (3,1,1,1,1,Min)(2,2,1,1,1,Min) (2,1,1,1,1,1,Max)

All rights reservedL. Manevitz Lecture 326 Mini-max Search See if limit of search has been reached : Yes : Compute static evaluation of current position + return value. Otherwise : If maximizing level – apply Mini-max to each child. Return maximum of results. If minimizing level – apply Mini-max to each child. Return minimum of results.

All rights reservedL. Manevitz Lecture 327 Example X X OO X X OOX X X OO X X X OO XX X OO XX X OO X

All rights reservedL. Manevitz Lecture 328 Example cont. e(p) = number of directions open for Max – number of directions open for Min e(p) = inf if win for Max e(p) = - inf if win for Min e(p) = 6 – 4 = 2 X O

All rights reservedL. Manevitz Lecture 329 Example cont. X X OOX X X OOX X X OOX X X OOX X X OOX O OO O 2-1=13-1=22-1=13-1=2 Min move 1

All rights reservedL. Manevitz Lecture 330 Example cont. X X OO X O - inf3-2=12-2=03-2=1 Min move - inf X X OO X X X OO X X X OO X X X OO X OO O

All rights reservedL. Manevitz Lecture 331 Example cont. - inf2-2=0 Min move - inf X X OO XX X OO XX X OO XX X OO XX X OO X 3-2=1 O O O O

All rights reservedL. Manevitz Lecture 332 Example cont. - inf2-1=13-1=2 Min move - inf 3-1=2 X X OO XX X OO XX X OO XX X OO XX X OO X O O O O

All rights reservedL. Manevitz Lecture 333 Example cont. - inf2-1=13-1=2 Min move - inf 2-1=1 X X OO X X X OO X X X OO X X X OO X X X OO X O O OO

All rights reservedL. Manevitz Lecture 334 Example cont. X X OO X X OOX X X OO X X X OO XX X OO XX X OO X - inf 1 Max move1

All rights reservedL. Manevitz Lecture 335 Mini-max Algorithm Mini-max (Position,Depth) 1.If DeepEnough (Position,Depth) 1.then Return <Static (Position,Depth  2.Successors := MoveGen (Position,Depth)

All rights reservedL. Manevitz Lecture 336 Mini-max Algorithm cont. 3.If Depth Odd (Max node) 1.then Loop until Successors =  1.Best = - inf 2.Remove m from Successors 3. := Minimax (m,Depth+1) 4.If Value > Best then : 1.Best := Value 2.BestPath := m^Path 5.End Loop 2.Return

All rights reservedL. Manevitz Lecture 337 Mini-max Algorithm cont. 4.If Depth Even (Min node) 1.then Loop until Successors =  1.Best = inf 2.Remove m from Successors 3. := Minimax (m,Depth+1) 4.If Value < Best then : 1.Best := Value 2.BestPath := m^Path 5.End Loop 2.Return

All rights reservedL. Manevitz Lecture 338  Mini-max   –values at Max nodes never decrease.   values at Min nodes never increase.

All rights reservedL. Manevitz Lecture 339 Cut - Off Below any MIN node having  value smaller than  value of an ancestor. Below any MAX node having  value greater than  value of an ancestor.

All rights reservedL. Manevitz Lecture 340 Computing    of Max node : current largest backed up value of child.   of Min node : current smallest backed up value of child.

All rights reservedL. Manevitz Lecture 341  Mini-max Keep track of  values and send on to children : 1)Search discontinued below any Min node with  an  of one of it’s ancestors. Set final value of node to be this  value. 2)Search discontinued below any Max node with  a  of one of it’s ancestors. Set final value of node to be this  value.

All rights reservedL. Manevitz Lecture 342 Example –  Cut-Off Max Min 27 =2 >=2   <=1 1 This is a  Cut-Off

All rights reservedL. Manevitz Lecture 343  Mini-max Algorithm 1.Determine if the level is : 1.The top level. 2.The limit of search has been reached. 3.The level is a minimizing level. 4.The level is a maximizing level

All rights reservedL. Manevitz Lecture 344  Mini-max Algorithm cont. 2.If the level is the top level : 1.Let alpha be –inf and let beta be inf. 3.If the limit of search has been reached : compute the static value of the current position relative to the appropriate player + Return result.

All rights reservedL. Manevitz Lecture 345  Mini-max Algorithm cont. 4.If the level is a minimizing level : 1.Until all children are examined with Minimax or alpha is bigger then beta : 1.Set beta to the smaller of the given beta values and the smallest value so far reported by Minimax working on the children. 2.Use Minimax on the next child of the current position, handing this new application of Minimax the current alpha and beta. 2.Report beta.

All rights reservedL. Manevitz Lecture 346  Mini-max Algorithm cont. 5.If the level is a maximizing level : 1.Until all children are examined with Minimax or alpha is bigger then beta : 1.Set alpha to the larger of the given alpha values and the biggest value so far reported by Minimax working on the children. 2.Use Minimax on the next child of the current position, handing this new application of Minimax the current alpha and beta. 2.Report alpha.

All rights reservedL. Manevitz Lecture 347 ≥≥  Max node Min node  ≤≤ 3  ≥≥ ≥≥ ≤≤  =2 ≥≥ ≤≤ ≥≥ ≥≥

All rights reservedL. Manevitz Lecture 348 Max node Min node Cut Off ≥≥ β=1 ≥≥ β=-3 β≤1 ≥≥ ≥≥ β=3 ≥≥ β≤-3 β≤3 ≥≥ β=4 ≥≥ β≤4 ≥≥ ≥≥

All rights reservedL. Manevitz Lecture 349 Example Max node Min node Cut Off      

All rights reservedL. Manevitz Lecture 350 Example Max node Min node Cut Off      

All rights reservedL. Manevitz Lecture 351 Other Adjustments Progressive Deepening (Analyze depth1,depth2,…). Heuristic Pruning (Order moves plausibly). Futility Cut-Off. Heuristic Continuation (Waiting for Quiescence). Horizon effect. Secondary Search.

All rights reservedL. Manevitz Lecture 352 Homework Number 1 Implement BOTH the Mini-max and The Alpha-Beta Algorithm for a Beloved Game. Suggestion : Othello (not allowed), Checkers, Chinese Checkers, Othello (for losers), Chess etc. Due date (Penalty for lateness).

All rights reservedL. Manevitz Lecture 353 Other Adjustments Progressive Deepening (Analyze depth1,depth2,…). Heuristic Pruning (Order moves plausibly). Futility Cut-Off. Heuristic Continuation (Waiting for Quiescence). Horizon effect. Secondary Search.

All rights reservedL. Manevitz Lecture 354 Homework Number 1 Implement BOTH the Mini-max AND The Alpha-Beta Algorithm for a Beloved Game. Suggestion : Checkers (Damka), Othello (losers), regular Othello not allowed, Chess etc. Due date Dec 20 (before class) (Penalty for lateness): -4 up to one week. then -4 each class (before class)