Foundations of Artificial Intelligence

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

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

ARTIFICIAL INTELLIGENCE (CS 370D)

Adversarial Search 1

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

Programming Project 1: Pacman (Due )

School of EECS Washington State University. Artificial Intelligence

CSE 473: Artificial Intelligence. Outline

CS 5522: Artificial Intelligence II

Foundations of Artificial Intelligence

CS 188: Artificial Intelligence

Adversary Search. Ref: Chapter 5

Game Playing State-of-the-Art

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

Artificial Intelligence. Minimax and alpha-beta pruning

CS 387: GAME AI BOARD GAMES. 5/24/2016 Instructor: Santiago Ontañón

Theory and Practice of Artificial Intelligence

Foundations of Artificial Intelligence

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

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

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

CS 387/680: GAME AI BOARD GAMES

Artificial Intelligence

Computer Game Programming Board Games

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

mywbut.com Two agent games : alpha beta pruning

Contents. Foundations of Artificial Intelligence. Problems. Why Board Games?

46.1 Introduction. Foundations of Artificial Intelligence Introduction MCTS in AlphaGo Neural Networks. 46.

Games (adversarial search problems)

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

COMP9414: Artificial Intelligence Adversarial Search

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

Tree representation Utility function

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

Adversarial Search Lecture 7

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

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

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

CS 4700: Artificial Intelligence

Adversarial Search: Game Playing. Reading: Chapter

Data Structures and Algorithms

Game Playing Part 1 Minimax Search

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

Game-playing: DeepBlue and AlphaGo

43.1 Introduction. Foundations of Artificial Intelligence Introduction Monte-Carlo Methods Monte-Carlo Tree Search. 43.

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

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

CS 771 Artificial Intelligence. Adversarial Search

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

CITS3001. Algorithms, Agents and Artificial Intelligence. Semester 2, 2016 Tim French

Foundations of AI. 6. Board Games. Search Strategies for Games, Games with Chance, State of the Art

Game Engineering CS F-24 Board / Strategy Games

Artificial Intelligence Adversarial Search

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

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

Foundations of AI. 6. Adversarial Search. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard & Bernhard Nebel

Game-Playing & Adversarial Search

Artificial Intelligence 1: game playing

Games and Adversarial Search

CSC 380 Final Presentation. Connect 4 David Alligood, Scott Swiger, Jo Van Voorhis

Lecture 5: Game Playing (Adversarial Search)

Foundations of Artificial Intelligence Introduction State of the Art Summary. classification: Board Games: Overview

Artificial Intelligence

Foundations of AI. 5. Board Games. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard and Luc De Raedt SA-1

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

Unit-III Chap-II Adversarial Search. Created by: Ashish Shah 1

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

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

Artificial Intelligence

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

Adversarial Search and Game Playing

Agenda Artificial Intelligence. Why AI Game Playing? The Problem. 6. Adversarial Search What To Do When Your Solution is Somebody Else s Failure

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

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

CS 331: Artificial Intelligence Adversarial Search II. Outline

Game Playing. Chapter 8

CSE 473: Ar+ficial Intelligence

Last update: March 9, Game playing. CMSC 421, Chapter 6. CMSC 421, Chapter 6 1

CS 4700: Foundations of Artificial Intelligence

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

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

2 person perfect information

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

More on games (Ch )

CS188 Spring 2010 Section 3: Game Trees

Game playing. Chapter 5, Sections 1 6

CSE 573: Artificial Intelligence

CS-E4800 Artificial Intelligence

Path Planning as Search

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

CS188 Spring 2014 Section 3: Games

16.410/413 Principles of Autonomy and Decision Making

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

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

More on games (Ch )

CS188 Spring 2010 Section 3: Game Trees

Artificial Intelligence

game tree complete all possible moves

Game Playing Beyond Minimax. Game Playing Summary So Far. Game Playing Improving Efficiency. Game Playing Minimax using DFS.

Transcription:

Foundations of Artificial Intelligence 42. Board Games: Alpha-Beta Search Malte Helmert University of Basel May 16, 2018

Board Games: Overview chapter overview: 40. Introduction and State of the Art 41. Minimax Search and Evaluation Functions 42. Alpha-Beta Search 43. Monte-Carlo Tree Search: Introduction 44. Monte-Carlo Tree Search: Advanced Topics 45. AlphaGo and Outlook

Alpha-Beta Search

Alpha-Beta Search 3 A1 A2 A3 MIN 3 2 2 A11 A12 A13 A21 A22 A23 A31 A32 A33 3 12 8 2 4 6 14 5 2 Can we save search effort? We do not need to consider all the nodes!

Alpha-Beta Search 3 A1 A2 A3 MIN 3 2 2 A11 A12 A13 A21 A22 A23 A31 A32 A33 3 12 8 2 4 6 14 5 2 Can we save search effort? We do not need to consider all the nodes! 3 A1 A2 A3 MIN 3 2 2 A11 A12 A13 A21 A22 A23 A31 A32 A33 3 12 8 2 14 5 2

Alpha-Beta Search: Generally Player Opponent m...... Player Opponent n If m > n, then node with utility n will never be reached when playing perfectly!

Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is α, then the subtree is not interesting because will never enter it when playing perfectly. If the utility value in the current subtree is β, then the subtree is not interesting because MIN will never enter it when playing perfectly. If α β in the subtree, then the subtree is not interesting and does not have to be searched further (α-β pruning). Starting with α = and β = +, alpha-beta search produces the identical result as minimax, with lower seach effort.

Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is α, then the subtree is not interesting because will never enter it when playing perfectly. If the utility value in the current subtree is β, then the subtree is not interesting because MIN will never enter it when playing perfectly. If α β in the subtree, then the subtree is not interesting and does not have to be searched further (α-β pruning). Starting with α = and β = +, alpha-beta search produces the identical result as minimax, with lower seach effort.

Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is α, then the subtree is not interesting because will never enter it when playing perfectly. If the utility value in the current subtree is β, then the subtree is not interesting because MIN will never enter it when playing perfectly. If α β in the subtree, then the subtree is not interesting and does not have to be searched further (α-β pruning). Starting with α = and β = +, alpha-beta search produces the identical result as minimax, with lower seach effort.

Alpha-Beta Search: Idea idea: Use two values α and β during minimax depth-first search, such that the following holds for every recursive call: If the utility value in the current subtree is α, then the subtree is not interesting because will never enter it when playing perfectly. If the utility value in the current subtree is β, then the subtree is not interesting because MIN will never enter it when playing perfectly. If α β in the subtree, then the subtree is not interesting and does not have to be searched further (α-β pruning). Starting with α = and β = +, alpha-beta search produces the identical result as minimax, with lower seach effort.

Alpha-Beta Search: Pseudo Code algorithm skeleton the same as minimax function signature extended by two variables α and β function alpha-beta-main(p) v, move := alpha-beta(p,, + ) return move

Alpha-Beta Search: Pseudo-Code function alpha-beta(p, α, β) if p is terminal position: return u(p), none initialize v and best move for each move, p succ(p): v, best move := alpha-beta(p, α, β) update v and best move if player(p) = : if v β: return v, none α := max{α, v} if player(p) = MIN: if v α: return v, none β := min{β, v} return v, best move [as in minimax] [as in minimax]

Alpha-Beta Search: Example, [, ] A 1 A 2 A 3 MIN A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example, [, ] A 1 A 2 A 3 MIN, [, ] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example, [, ] A 1 A 2 A 3 MIN 3, [, 3] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example, [, ] A 1 A 2 A 3 MIN 3, [, 3] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example, [, ] A 1 A 2 A 3 MIN 3, [, 3] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3], [3, ] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] 2, [3, ] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] 2, [3, ], [3, ] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] 2, [3, ] 14, [3, 14] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] 2, [3, ] 5, [3, 5] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] 2, [3, ] 2, [3, 5] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2

Move Ordering

Alpha-Beta Search: Example 3, [3, ] A 1 A 2 A 3 MIN 3, [, 3] 2, [3, ] 2, [3, 5] A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33 3 12 8 2 14 5 2 If the last successor had been first, the rest of the subtree would have been pruned.

Move Ordering idea: consider first the successors that are likely to be best. Domain-specific ordering function e.g. chess: captures < threats < forward moves < backward moves Dynamic move-ordering try first moves that have been good in the past e.g. in iterative deepening search: best moves from previous iteration

How Much Do We Gain with Alpha-Beta Search? assumption: uniform game tree, depth d, branching factor b 2; assumption: and MIN positions alternating perfect move ordering best move at every position is considered first (this cannot be done in practice Why?) maximizing move for, minimizing move for MIN effort reduced from O(b d ) (minimax) to O(b d/2 ) doubles the search depth that can be achieved in same time random move ordering effort still reduced to O(b 3d/4 ) (for moderate b) In practice, it is often possible to get close to the optimum.

Summary

Summary alpha-beta search stores which utility both players can force somewhere else in the game tree exploits this information to avoid unnecessary computations can have significantly lower search effort than minimax best case: search twice as deep in the same time