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

Similar documents
Game Playing State-of-the-Art

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

CS 188: Artificial Intelligence

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

Artificial Intelligence

CS 5522: Artificial Intelligence II

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

Programming Project 1: Pacman (Due )

CSE 473: Ar+ficial Intelligence

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

CSE 40171: Artificial Intelligence. Adversarial Search: Games and Optimality

Adversarial Search 1

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

CS 188: Artificial Intelligence

CSE 573: Artificial Intelligence

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

CS 188: Artificial Intelligence Spring Announcements

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

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

CSE 473: Artificial Intelligence. Outline

Adversarial Search Lecture 7

CS 188: Artificial Intelligence. Overview

Lecture 5: Game Playing (Adversarial Search)

Game Playing State of the Art

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

Project 1. Out of 20 points. Only 30% of final grade 5-6 projects in total. Extra day: 10%

Game playing. Chapter 5, Sections 1 6

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

ARTIFICIAL INTELLIGENCE (CS 370D)

Games and Adversarial Search

CS 188: Artificial Intelligence

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

Game Playing State-of-the-Art. CS 188: Artificial Intelligence. Behavior from Computation. Adversarial Games. Deterministic Games.

Adversary Search. Ref: Chapter 5

Adversarial Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 9 Feb 2012

Game Playing: Adversarial Search. Chapter 5

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

Game playing. Chapter 6. Chapter 6 1

CS 188: Artificial Intelligence Spring 2007

Game Playing. Philipp Koehn. 29 September 2015

CS 380: ARTIFICIAL INTELLIGENCE

Adversarial Search. CMPSCI 383 September 29, 2011

Outline. Game playing. Types of games. Games vs. search problems. Minimax. Game tree (2-player, deterministic, turns) Games

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

Game playing. Chapter 5. Chapter 5 1

School of EECS Washington State University. Artificial Intelligence

Games vs. search problems. Game playing Chapter 6. Outline. Game tree (2-player, deterministic, turns) Types of games. Minimax

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

Artificial Intelligence

Game playing. Chapter 6. Chapter 6 1

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

Games vs. search problems. Adversarial Search. Types of games. Outline

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

Adversarial Search and Game Playing

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

Ar#ficial)Intelligence!!

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 4: Search 3.

Artificial Intelligence. Topic 5. Game playing

Announcements. CS 188: Artificial Intelligence Fall Today. Tree-Structured CSPs. Nearly Tree-Structured CSPs. Tree Decompositions*

Path Planning as Search

Game Playing. Dr. Richard J. Povinelli. Page 1. rev 1.1, 9/14/2003

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

Games (adversarial search problems)

Adversarial search (game playing)

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

Data Structures and Algorithms

ADVERSARIAL SEARCH. Chapter 5

COMP219: Artificial Intelligence. Lecture 13: Game Playing

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram

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

CS 331: Artificial Intelligence Adversarial Search II. Outline

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

Game playing. Outline

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

CSE 573: Artificial Intelligence Autumn 2010

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 2 February, 2018

Artificial Intelligence

Game Engineering CS F-24 Board / Strategy Games

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

CS 4700: Foundations of Artificial Intelligence

Artificial Intelligence 1: game playing

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

Theory and Practice of Artificial Intelligence

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

Foundations of Artificial Intelligence

Artificial Intelligence

Game playing. Chapter 5, Sections 1{5. AIMA Slides cstuart Russell and Peter Norvig, 1998 Chapter 5, Sections 1{5 1

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

Foundations of Artificial Intelligence

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence

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

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

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

More Adversarial Search

CS 4700: Artificial Intelligence

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

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

Game-Playing & Adversarial Search

Games and Adversarial Search II

Transcription:

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

4-2 4 max min -1-2 4 9??? Image credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188 31

Resource Limits Problem: In realistic games, cannot search to leaves! Solution: Depth-limited search Instead, search only to a limited depth in the tree Replace terminal utilities with an evaluation function for non-terminal positions Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Resource Limits Example: Suppose we have 100 seconds and can explore 10K nodes / sec This means we can check 1M nodes per move α-β pruning reaches about depth 8 decent chess program Guarantee of optimal play is gone Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Depth Matters Evaluation functions are always imperfect The deeper in the tree the evaluation function is buried, the less the quality of the evaluation function matters An important example of the tradeoff between complexity of features and complexity of computation

Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188 Game Tree Pruning

Minimax Example 3 12 8 2 4 6 14 5 2 Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Image credit: Russell and Norvig Motivating Example

Minimax Pruning 3 12 8 2 14 5 2 Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Alpha-Beta Pruning When applied to a standard minimax tree, it returns the same move as minimax would But always prunes away branches that cannot possibly influence the final decision

What are alpha and beta? α = the value of the best (i.e., highest-value) choice we have found so far at any choice point along the path for MAX. β = the value of the best (i.e., lowest-value) choice we have found so far at any choice point along the path for MIN.

General Configuration (MIN Version) We re computing the MIN-VALUE at some node n We re looping over n s children n s estimate of the childrens min is dropping Who cares about n s value? MAX Let a be the best value that MAX can get at any choice point along the current path from the root If n becomes worse than a, MAX will avoid it, so we can stop considering n s other children (it s already bad enough that it won t be played) MAX MIN MAX MIN a n Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

General Configuration (MAX Version) MAX The MAX version is simply symmetric MIN MAX a MIN n Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Alpha-Beta Implementation α: MAX s best option on path to root β: MIN s best option on path to root def max-value(state, α, β): initialize v = - for each successor of state: v = max(v, value(successor, α, β)) if v β return v α = max(α, v) return v def min-value(state, α, β): initialize v = + for each successor of state: v = min(v, value(successor, α, β)) if v α return v β = max(β, v) return v Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Alpha-Beta Pruning Properties This pruning has no effect on minimax value computed for the root! max Values of intermediate nodes might be wrong Important: children of the root may have the wrong value So the most naive version won t let you do action selection 10 10 0 min Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Demo: Minimax + Alpha-Beta Pruning https://www.youtube.com/watch?v=_beqjkxz1-u

Alpha-Beta Pruning Properties Good child ordering improves effectiveness of pruning max With perfect ordering : Time complexity drops to O(b m/2 ) Doubles solvable depth! Full search of, e.g., chess, is still hopeless 10 10 0 min This is a simple example of metareasoning (computing about what to compute) Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Quiz Image Credit: http://inst.eecs.berkeley.edu/~cs61b/fa14/ta-materials/apps/ab_tree_practice/

Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188 Evaluation Functions

It turns out that alpha-beta pruning isn t so good It must search all the way to terminal states for at least a portion of the search space This is usually not practical, because we need to play the game in a reasonable amount of time Shannon s suggestion: cutoff earlier via a heuristic evaluation function Claude Shannon BY-NC-SA 2.0 tericee

Cutoff Test H-MINIMAX(s, d) = EVAL(S) if CUTOFF-TEST(s, d) maxα Actions(s) = H-MINMAX(RESULT(s, α), d + 1) if PLAYER(s) = MAX {min Actions(s) = H-MINMAX(RESULT(s, α), d + 1) if PLAYER(s) = MIN

Evaluation Functions Evaluation functions score non-terminals in depth-limited search Slide credit: Dan Klein and Pieter Abbeel, UC Berkeley CS 188

Evaluation Functions Ideal function: returns the actual minimax value of the position In practice: typically weighted linear sum of features: e.g. f1(s) = (num white queens num black queens), etc.

Be wary of simple approaches Heuristic: Material Advantage Image credit: Russell and Norvig

Be wary of simple approaches Probable win for black Image credit: Russell and Norvig

Image credit: Russell and Norvig Be wary of simple approaches

Horizon Effect When the program is facing an opponent s move that causes serious damage and is ultimately unavoidable, but can be temporarily avoided by delaying tactics.

Horizon Effect Inevitable Loss Image credit: Russell and Norvig

Horizon Effect The loss is simply delayed Image credit: Russell and Norvig

Search vs. Lookup There are many standard openings and closings in chess Why bother with search when you can simply use a lookup table? Bantam 1982

Search vs. Lookup Computers are particularly good at the endgame Example: king, bishop, and knight vs. king 462 ways a king can be placed without being adjacent 62 empty squares for the bishop, 61 for the knight, and 2 players to move next 462 62 61 2 = 3,494,568 possible positions