ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.

Slides:



Advertisements
Similar presentations
Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Advertisements

Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
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.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
This lecture topic: Game-Playing & Adversarial Search
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Adversarial Search Chapter 6.
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Artificial Intelligence in Game Design
This time: Outline Game playing The minimax algorithm
Lecture 02 – Part C Game Playing: Adversarial Search
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
CS 561, Sessions Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first.
Game Playing CSC361 AI CSC361: Game Playing.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
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)
1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Chap. 6 [AIMA] Chang-Sheng Chen.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
CHAPTER 6 : ADVERSARIAL SEARCH
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
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.
Game Playing.
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.
Adversarial Search CS311 David Kauchak Spring 2013 Some material borrowed from : Sara Owsley Sood and others.
Game-playing AIs Part 1 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part I (this set of slides)  Motivation  Game Trees  Evaluation.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Notes on Game Playing by Yun Peng of theYun Peng University of Maryland Baltimore County.
Game Playing. Towards Intelligence? Many researchers attacked “intelligent behavior” by looking to strategy games involving deep thought. Many researchers.
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.
CSCI 4310 Lecture 6: Adversarial Tree Search. Book Winston Chapter 6.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
Adversarial Search 2 (Game Playing)
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
Adversarial Search Chapter 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
Adversarial Search CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and Java.
1 Chapter 6 Game Playing. 2 Chapter 6 Contents l Game Trees l Assumptions l Static evaluation functions l Searching game trees l Minimax l Bounded lookahead.
Adversarial Search and Game-Playing
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
Game Playing in AI by: Gaurav Phapale 05 IT 6010
Artificial Intelligence
Artificial Intelligence
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems

(CHAPTER-5) ADVERSARIAL SEARCH

ADVERSARIAL SEARCH  Optimal decisions  MinMax algorithm  α-β pruning  Imperfect, real-time decisions 3

ADVERSARIAL SEARCH 4

 Search problems seen so far: Single agent. No interference from other agents and no competition.  Game playing: Multi-agent environment. Cooperative games. Competitive games  adversarial search  Specifics of adversarial search: Sequences of player’s decisions we control. Decisions of other players we do not control.

Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits  unlikely to find goal, must approximate

Game as Search Problem MinMax Algorithm 7

Game setup  Consider a game with Two players: (Max) and (Min)  Max moves first and they take turns until the game is over. Winner gets award, loser gets penalty.  Games as search:  Initial state: e.g. board configuration of chess  Successor function: list of (move, state) pairs specifying legal moves.  Goal test: Is the game finished?  Utility function: Gives numerical value of terminal states. E.g. win (+1), lose (-1) and draw (0) in tic-tac-toe  Max uses search tree to determine next move. 8

9  MAX has 9 possible first moves, etc.  Utility value is always from the point of view of MAX.  High values good for MAX and bad for MIN. Example of an ADVERSARIAL two player Game Tic-Tac-Toe (TTT)

10 Example of an adversarial 2 person game: Tic-tac-toe

How to Play a Game by Searching General Scheme Consider all legal moves, each of which will lead to some new state of the environment (‘board position’) Evaluate each possible resulting board position Pick the move which leads to the best board position. Wait for your opponent’s move, then repeat. Key problems Representing the ‘board’ Representing legal next boards Evaluating positions Looking ahead 11

Game Trees  Represent the problem space for a game by a tree  Nodes represent ‘board positions’ (state)  edges represent legal moves.  Root node is the position in which a decision must be made.  Evaluation function f assigns real-number scores to `board positions.’  Terminal nodes (leaf) represent ways the game could end, labeled with the desirability of that ending (e.g. win/lose/draw or a numerical score) 12

MAX & MIN Nodes When I move, I attempt to MAXimize my performance. When my opponent moves, he attempts to MINimize my performance. TO REPRESENT THIS: If we move first, label the root MAX; if our opponent does, label it MIN. Alternate labels for each successive tree level. if the root (level 0) is our turn (MAX), all even levels will represent turns for us (MAX), and all odd ones turns for our opponent (MIN). 13

Evaluation functions Evaluations how good a ‘board position’ is Based on static features of that board alone Zero-sum assumption lets us use one function to describe goodness for both players. f(n)>0 if we are winning in position n f(n)=0 if position n is tied f(n)<0 if our opponent is winning in position n Build using expert knowledge (Heuristic), Tic-tac-toe: f(n)=(# of 3 lengths possible for me) - (# 3 lengths possible for you) 14

Heuristic measuring for adversarial tic-tac-toe Maximize E(n) E(n) = 0 when my opponent and I have equal number of possibilities. 15

MinMax Algorithm Main idea: choose move to position with highest minimax value. = best achievable payoff against best play. E.g., 2-ply game: 16

17 MinMax Algorithm

MinMax steps Int MinMax (state s, int depth, int type) { if( terminate(s)) return Eval(s); if( type == max ) { for ( child =1, child <= NmbSuccessor(s); child++) { value = MinMax(Successor(s, child), depth+1, Min) if( value > BestScore) BestScore = Value; } if( type == min ) { for ( child =1, child <= NmbSuccessor(s); child++) { value = MinMax(Successor(s, child), depth+1, Max) if( value < BestScore) BestScore = Value; } return BestScore; } 18

Minimax tree Max Min Max Min

Minimax tree Max Min Max Min

Minimax tree Max Min Max Min

Minimax tree Max Min Max Min

Minimax max min max min 23

Minimax max min max min

MinMax Analysis Time Complexity: O(b d) Space Complexity: O(b*d) Optimality: Yes Problem: Game  Resources Limited! Time to make an action is limited Can we do better ? Yes ! How ? Cutting useless branches ! 25

 Cuts If the current max value is greater than the successor’s min value, don’t explore that min subtree any more 26

 Cut example Max Min 27

 Cut example Depth first search along path Max Min 28

 Cut example 21 is minimum so far (second level) Can’t evaluate yet at top level Max Min 21 29

 Cut example -3 is minimum so far (second level) -3 is maximum so far (top level) Max Min -3 30

 Cut example -70 is now minimum so far (second level) -3 is still maximum (can’t use second node yet) Max Min

 Cut example Since second level node will never be > -70, it will never be chosen by the previous level We can stop exploring that node Max Min

 Cut example Evaluation at second level is Max Min

 Cut example Again, can apply  cut since the second level node will never be > -73, and thus will never be chosen by the previous level Max Min

 Cut example As a result, we evaluated the Max node without evaluating several of the possible paths Max Min

 cuts Similar idea to  cuts, but the other way around If the current minimum is less than the successor’s max value, don’t look down that max tree any more 36

 Cut example Some subtrees at second level already have values > min from previous, so we can stop evaluating them Min Max

 -  Pruning Pruning by these cuts does not affect final result May allow you to go much deeper in tree “Good” ordering of moves can make this pruning much more efficient Evaluating “best” branch first yields better likelihood of pruning later branches Perfect ordering reduces time to b m/2 i.e. doubles the depth you can search to! 38

 -  Pruning Can store information along an entire path, not just at most recent levels! Keep along the path:  : best MAX value found on this path (initialize to most negative utility value)  : best MIN value found on this path (initialize to most positive utility value) 39

The Alpha and the Beta For a leaf,  =  = utility At a max node:  = largest child utility found so far  =  of parent At a min node:  =  of parent  = smallest child utility found so far For any node:  <= utility <=  “If I had to decide now, it would be...” 40

Alpha-Beta example 41

The Alpha-Beta Procedure Example: max min max min

The Alpha-Beta Procedure 4 Example: max min max min  = 4

The Alpha-Beta Procedure 4 Example: max min max min  = 4 5

The Alpha-Beta Procedure 4 Example: max min max min  = 3 53  = 3

The Alpha-Beta Procedure 4 Example: max min max min  = 3 53  = 3  = 1 1

The Alpha-Beta Procedure 4 Example: max min max min  = 3 53  = 3  = 1 1  = 3

The Alpha-Beta Procedure 4 Example: max min max min  = 3 53  = 3  = 1 1  = 3  = 8 8

The Alpha-Beta Procedure 4 Example: max min max min  = 3 53  = 3  = 1 1  = 3  =6 86

The Alpha-Beta Procedure 4 Example: max min max min  = 3 53  = 3  = 1 1  = 3  =6 867  = 6

Thank you End of Chapter 5 51