ARTIFICIAL INTELLIGENCE (CS 370D)

Similar documents
Game-playing AIs: Games and Adversarial Search I AIMA

Module 3. Problem Solving using Search- (Two agent) Version 2 CSE IIT, Kharagpur

Adversarial Search and Game- Playing C H A P T E R 6 C M P T : S P R I N G H A S S A N K H O S R A V I

Adversary Search. Ref: Chapter 5

CS 771 Artificial Intelligence. Adversarial Search

Computer Science and Software Engineering University of Wisconsin - Platteville. 4. Game Play. CS 3030 Lecture Notes Yan Shi UW-Platteville

mywbut.com Two agent games : alpha beta pruning

Game-Playing & Adversarial Search

2 person perfect information

Games (adversarial search problems)

CS 1571 Introduction to AI Lecture 12. Adversarial search. CS 1571 Intro to AI. Announcements

Artificial Intelligence 1: game playing

CS 2710 Foundations of AI. Lecture 9. Adversarial search. CS 2710 Foundations of AI. Game search

Artificial Intelligence. Minimax and alpha-beta pruning

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter , 5.7,5.8

Adversarial Search 1

Announcements. Homework 1 solutions posted. Test in 2 weeks (27 th ) -Covers up to and including HW2 (informed search)

CS885 Reinforcement Learning Lecture 13c: June 13, Adversarial Search [RusNor] Sec

Computer Game Programming Board Games

Game Playing. Why do AI researchers study game playing? 1. It s a good reasoning problem, formal and nontrivial.

Adversarial Search and Game Playing. Russell and Norvig: Chapter 5

Programming Project 1: Pacman (Due )

Adversarial Search (Game Playing)

Adversarial Search. Human-aware Robotics. 2018/01/25 Chapter 5 in R&N 3rd Ø Announcement: Slides for this lecture are here:

CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search

game tree complete all possible moves

Game Tree Search. CSC384: Introduction to Artificial Intelligence. Generalizing Search Problem. General Games. What makes something a game?

Artificial Intelligence. 4. Game Playing. Prof. Bojana Dalbelo Bašić Assoc. Prof. Jan Šnajder

Game-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro) 1

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter Read , Skim 5.7

Game Playing AI Class 8 Ch , 5.4.1, 5.5

Set 4: Game-Playing. ICS 271 Fall 2017 Kalev Kask

CS 5522: Artificial Intelligence II

COMP9414: Artificial Intelligence Adversarial Search

Artificial Intelligence

CS 4700: Foundations of Artificial Intelligence

CPS331 Lecture: Search in Games last revised 2/16/10

Adversarial Search. Robert Platt Northeastern University. Some images and slides are used from: 1. CS188 UC Berkeley 2. RN, AIMA

CS188 Spring 2010 Section 3: Game Trees

Adversarial Search Aka Games

Adversarial Search. Rob Platt Northeastern University. Some images and slides are used from: AIMA CS188 UC Berkeley

Game Playing State-of-the-Art

COMP219: Artificial Intelligence. Lecture 13: Game Playing

CMPUT 396 Tic-Tac-Toe Game

Playing Games. Henry Z. Lo. June 23, We consider writing AI to play games with the following properties:

Algorithms for Data Structures: Search for Games. Phillip Smith 27/11/13

Game Playing State-of-the-Art. CS 188: Artificial Intelligence. Behavior from Computation. Video of Demo Mystery Pacman. Adversarial Search

CS188 Spring 2010 Section 3: Game Trees

CS 188: Artificial Intelligence

Adversarial Search. CS 486/686: Introduction to Artificial Intelligence

Adversarial Search and Game Playing

Adversarial Search. CS 486/686: Introduction to Artificial Intelligence

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing

2/5/17 ADVERSARIAL SEARCH. Today. Introduce adversarial games Minimax as an optimal strategy Alpha-beta pruning Real-time decision making

Game Engineering CS F-24 Board / Strategy Games

CSE 473: Artificial Intelligence Fall Outline. Types of Games. Deterministic Games. Previously: Single-Agent Trees. Previously: Value of a State

Multiple Agents. Why can t we all just get along? (Rodney King)

CSC384: Introduction to Artificial Intelligence. Game Tree Search

Game Tree Search. Generalizing Search Problems. Two-person Zero-Sum Games. Generalizing Search Problems. CSC384: Intro to Artificial Intelligence

Adversarial Search: Game Playing. Reading: Chapter

16.410/413 Principles of Autonomy and Decision Making

Foundations of Artificial Intelligence

Adversarial Search Lecture 7

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

Adversarial Search. Read AIMA Chapter CIS 421/521 - Intro to AI 1

CSE 40171: Artificial Intelligence. Adversarial Search: Game Trees, Alpha-Beta Pruning; Imperfect Decisions

Game Playing State-of-the-Art CSE 473: Artificial Intelligence Fall Deterministic Games. Zero-Sum Games 10/13/17. Adversarial Search

Game-Playing & Adversarial Search Alpha-Beta Pruning, etc.

Game Playing Part 1 Minimax Search

CPS 570: Artificial Intelligence Two-player, zero-sum, perfect-information Games

Adversarial Search. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 5

V. Adamchik Data Structures. Game Trees. Lecture 1. Apr. 05, Plan: 1. Introduction. 2. Game of NIM. 3. Minimax

Artificial Intelligence Lecture 3

Artificial Intelligence

Data Structures and Algorithms

CS510 \ Lecture Ariel Stolerman

Game Playing: Adversarial Search. Chapter 5

Announcements. Homework 1. Project 1. Due tonight at 11:59pm. Due Friday 2/8 at 4:00pm. Electronic HW1 Written HW1

Outline. Game Playing. Game Problems. Game Problems. Types of games Playing a perfect game. Playing an imperfect game

ADVERSARIAL SEARCH. Chapter 5

Path Planning as Search

CS 331: Artificial Intelligence Adversarial Search II. Outline

Ar#ficial)Intelligence!!

Lecture 14. Questions? Friday, February 10 CS 430 Artificial Intelligence - Lecture 14 1

CS 188: Artificial Intelligence

CS440/ECE448 Lecture 9: Minimax Search. Slides by Svetlana Lazebnik 9/2016 Modified by Mark Hasegawa-Johnson 9/2017

Artificial Intelligence Adversarial Search

Games CSE 473. Kasparov Vs. Deep Junior August 2, 2003 Match ends in a 3 / 3 tie!

Adversarial search (game playing)

CS188 Spring 2014 Section 3: Games

CS 188: Artificial Intelligence Spring Announcements

CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH. Santiago Ontañón

CSE 332: Data Structures and Parallelism Games, Minimax, and Alpha-Beta Pruning. Playing Games. X s Turn. O s Turn. X s Turn.

CS 4700: Artificial Intelligence

Announcements. CS 188: Artificial Intelligence Spring Game Playing State-of-the-Art. Overview. Game Playing. GamesCrafters

CS 331: Artificial Intelligence Adversarial Search. Games we will consider

Theory and Practice of Artificial Intelligence

Solving Problems by Searching: Adversarial Search

Transcription:

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

(CHAPTER-5) ADVERSARIAL SEARCH

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

ADVERSARIAL SEARCH 4

Search problems seen so far: Game playing: Single agent. No interference from other agents and no competition. 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 Min Algorithm 7

Game setup Consider a game with Two players: () and (Min) 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 uses search tree to determine next move. 8 8

Example of an ADVERSARIAL two player Game Tic-Tac-Toe (TTT) 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. 9 9

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

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. 11 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. 12 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 14

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

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

Min Algorithm 17 17

Minimax tree Min Min 23 28 21-3 12 4 70-3 -12-70 -5-100 -73-14 -8-24 18 18

Minimax tree Min 28-3 12 70-3 100-73 -14-8 Min 23 28 21-3 12 4 70-3 -12-70 -5-100 -73-14 -8-24 19 19

Minimax tree Min -3-4 -73 21-3 12 70-4 100-73 -14-8 Min 23 28 21-3 12 4 70-4 -12-70 -5-100-73-14 -8-24 20 20

Minimax tree -3 Min -3-4 -73 21-3 12 70-4 100-73 -14-8 Min 23 28 21-3 12 4 70-4 -12-70 -5-100-73-14 -8-24 21 21

Minimax max min max min 22 22

Minimax max min 10 10 2 max 10 14 2 24 min 10 9 14 13 2 1 3 24 23 23

Min 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! 24 24

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

a Cut example -3 Min -3-4 -73 21-3 12 70-4 100-73 -14 26 26

a Cut example Min 21-3 12-70 -4 100-73 -14 Depth first search along path 1 27 27

a Cut example Min 21 21-3 12-70 -4 100-73 -14 21 is minimum so far (second level) Can t evaluate yet at top level 28 28

a Cut example -3 Min -3 21-3 12-70 -4 100-73 -14-3 is minimum so far (second level) -3 is maximum so far (top level) 29 29

a Cut example -3 Min -3-70 21-3 12-70 -4 100-73 -14-70 is now minimum so far (second level) -3 is still maximum (can t use second node yet) 30 30

a Cut example -3 Min -3-70 21-3 12-70 -4 100-73 -14 Since second level node will never be > -70, it will never be chosen by the previous level We can stop exploring that node 31 31

a Cut example -3 Min -3-70 -73 21-3 12-70 -4 100-73 -14 Evaluation at second level is -73 32 32

a Cut example -3 Min -3-70 -73 21-3 12-70 -4 100-73 -14 Again, can apply a cut since the second level node will never be > -73, and thus will never be chosen by the previous level 33 33

a Cut example -3 Min -3-70 -73 21-3 12-70 -4 100-73 -14 As a result, we evaluated the node without evaluating several of the possible paths 34 34

b cuts Similar idea to a 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 35 35

b Cut example Min 21 21 70 73 Min 21-3 12 70-4 100 73-14 Some subtrees at second level already have values > min from previous, so we can stop evaluating them. 36 36

a-b 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! 37 37

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

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

Alpha-Beta example 40

The Alpha-Beta Procedure Example: max min max min

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

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

The Alpha-Beta Procedure Example: max min a = 3 max b = 3 min 4 5 3

The Alpha-Beta Procedure Example: max min a = 3 max b = 3 b = 1 min 4 5 3 1

The Alpha-Beta Procedure Example: max b = 3 min a = 3 max b = 3 b = 1 min 4 5 3 1

The Alpha-Beta Procedure Example: max b = 3 min a = 3 max b = 3 b = 1 b = 8 min 4 5 3 1 8

The Alpha-Beta Procedure Example: max b = 3 min a = 3 max b = 3 b = 1 b =6 min 4 5 3 1 8 6

The Alpha-Beta Procedure Example: max b = 3 min a = 3 a = 6 max b = 3 b = 1 b =6 min 4 5 3 1 8 6 7

Thank you End of Chapter 5 50