CS 4700: Artificial Intelligence

Similar documents
Adversary Search. Ref: Chapter 5

Artificial Intelligence. Minimax and alpha-beta pruning

ARTIFICIAL INTELLIGENCE (CS 370D)

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

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

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

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

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

Adversarial Search Aka Games

CS 331: Artificial Intelligence Adversarial Search II. Outline

CS188 Spring 2010 Section 3: Game Trees

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

CS 771 Artificial Intelligence. Adversarial Search

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

Artificial Intelligence

Artificial Intelligence Adversarial Search

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

2 person perfect information

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

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

Foundations of Artificial Intelligence

game tree complete all possible moves

Game Playing Part 1 Minimax Search

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

Artificial Intelligence

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

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

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

Adversarial Search (Game Playing)

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

Artificial Intelligence Lecture 3

CS188 Spring 2010 Section 3: Game Trees

More Adversarial Search

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

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

Game-Playing & Adversarial Search

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

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

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

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

ADVERSARIAL SEARCH. Chapter 5

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

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

Artificial Intelligence 1: game playing

Games (adversarial search problems)

Adversarial Search 1

16.410/413 Principles of Autonomy and Decision Making

Games and Adversarial Search

mywbut.com Two agent games : alpha beta pruning

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

More on games (Ch )

Game Playing AI Class 8 Ch , 5.4.1, 5.5

CS440/ECE448 Lecture 11: Stochastic Games, Stochastic Search, and Learned Evaluation Functions

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

CS 188: Artificial Intelligence Spring Announcements

CMPUT 396 Tic-Tac-Toe Game

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

CS 188: Artificial Intelligence

Adversarial Search: Game Playing. Reading: Chapter

Computer Game Programming Board Games

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

Solving Problems by Searching: Adversarial Search

CS325 Artificial Intelligence Ch. 5, Games!

Artificial Intelligence

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

Adversarial Search and Game Playing

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

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

Game-playing AIs: Games and Adversarial Search I AIMA

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1

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

Instability of Scoring Heuristic In games with value exchange, the heuristics are very bumpy Make smoothing assumptions search for "quiesence"

Game Engineering CS F-24 Board / Strategy Games

CS 5522: Artificial Intelligence II

Ar#ficial)Intelligence!!

School of EECS Washington State University. Artificial Intelligence

Prepared by Vaishnavi Moorthy Asst Prof- Dept of Cse

CS 188: Artificial Intelligence. Overview

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

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

Five-In-Row with Local Evaluation and Beam Search

CS 4700: Foundations of Artificial Intelligence

More on games (Ch )

Adversarial Search. CMPSCI 383 September 29, 2011

CS510 \ Lecture Ariel Stolerman

Intuition Mini-Max 2

CS188 Spring 2014 Section 3: Games

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

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

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

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

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

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

Theory and Practice of Artificial Intelligence

Games we will consider. CS 331: Artificial Intelligence Adversarial Search. What makes games hard? Formal Definition of a Game.

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

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

Lecture 5: Game Playing (Adversarial Search)

Chess Algorithms Theory and Practice. Rune Djurhuus Chess Grandmaster / September 23, 2013

Adversarial search (game playing)

Transcription:

CS 4700: Foundations of Artificial Intelligence Fall 2017 Instructor: Prof. Haym Hirsh Lecture 10

Today Adversarial search (R&N Ch 5) Tuesday, March 7 Knowledge Representation and Reasoning (R&N Ch 7)

Alpha-Beta Pruning: General Case max min m If m is better than n then A will never be chosen, ignore A s other ops A max min n X

Minimax Algorithm minimax(s,ops,depth): {my turn} if cutoff(s,depth) then return V(s) else val - ; foreach o ops val maximin(apply(s,o),ops,depth+1); if val > val then val val ; bestop o; return val Initial call: If I go first: minimax(initial-state,ops,0) If opponent goes first: maximin(initial-state,ops,0) maximin(s,ops,depth): {opponent s turn} if cutoff(s,depth) then return V(s) else val + ; foreach o ops val minimax(apply(s,o),ops,depth+1); if val < val then val val ; bestop o; return val

minimax(s,ops,depth,a,b): {my turn} Minimax Algorithm with Alpha-Beta Pruning if cutoff(s,depth) then return V(s) else val - ; foreach o ops val maximin(apply(s,o),ops,depth+1,a,b); if val > val then val val ; bestop o; if val b then return val; a max(a,val) return val Initial call: If I go first: minimax(initial-state,ops,0,-,+ ) If opponent goes first: maximin(initial-state,ops,0,-,+ ) maximin(s,ops,depth,a,b): {opponent s turn} if cutoff(s,depth) then return V(s) else val + ; foreach o ops val minimax(apply(s,o),ops,depth+1 if val < val then,a,b); val val ; bestop o; if val a then return val; b min(b,val) return val

Game of Nim Three piles Each turn the current player picks one of the piles and removes at least one item from it

Game of Nim Three piles Each turn the current player picks one of the piles and removes at least one item from it

Game of Nim Three piles Each turn the current player picks one of the piles and removes at least one item from it

Game of Nim Three piles Each turn the current player picks one of the piles and removes at least one item from it

Game of Nim Three piles Each turn the current player picks one of the piles and removes at least one item from it

Game of Nim Three piles Each turn the current player picks one of the piles and removes at least one item from it Whoever takes the last item wins

Game of Nim States: (x 1,x 2,x 3 ) amounts in each of the three bins Operators: Remove(n,i): remove n items from Pile i (1 n x i ) Win condition: end in (0,0,0) for player who just moved V(0,0,0) = + if I moved last V(0,0,0) = - if my opponent moved last What about V(s) for states that are not terminal nodes?

Game of Nim Represent the number of items in each pile in binary Pile Size Binary 1 7 111 2 5 101 3 4 100

Game of Nim Represent the number of items in each pile in binary: Compute the ones digit of the sum of each columns of digits Pile Size Binary 1 7 111 2 5 101 3 4 100

Game of Nim Represent the number of items in each pile in binary Compute the ones digit of the sum of each columns of digits Pile Size Binary 1 7 111 2 5 101 3 4 100 110

Game of Nim Represent the number of items in each pile in binary Compute the ones digit of the sum of each columns of digits Pile Size Binary 1 7 111 2 5 101 3 4 100 110 V(s) = + if the sum is zero on my move, - if opponent s move To pick a move apply V(s) to each successor, pick one with V(s) = +

Game of Nim Represent the number of items in each pile in binary Compute the ones digit of the sum of each columns of digits Pile Size Binary 1 7 111 2 5 101 3 4 100 110 V(s) = + if the sum is zero on my move, - if opponent s move To pick a move apply V(s) to each successor, pick one with V(s) = + Can have V(s) that gives correct value without search

Othello (Reversi)

Othello (Reversi)

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) Place a piece so that on a row, column, or diagonal you surround a contiguous sequence of opponent pieces Flip all surrounded pieces

Othello (Reversi) V(s) = # of my pieces - # of opponent s pieces V(s) = 0 here

Othello (Reversi) V(s) = # of my pieces - # of opponent s pieces V(s) = 3 for white / -3 for black

Claude E. Shannon (1950) XXII. Programming a computer for playing chess, The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 41:314, 256-275

Claude E. Shannon (1950) XXII. Programming a computer for playing chess, The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 41:314, 256-275

Claude E. Shannon (1950) XXII. Programming a computer for playing chess, The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 41:314, 256-275

Common Form for Heuristic Evaluation Functions V s = w 1 f 1 s + w 2 f 2 s + + w n f n s = w i f i (s) n i=1

Additional Twists to Adversarial Search Non-zero sum More than two players Ordering/pruning branches Horizon effect Table lookup Stochastic games Learning evaluation functions Partially observable games

Two Players - 5 +4 + 1-6 - 4-2 + 6-3 - 6

Two Players Rewritten - 5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,5) (4,-4) (1,-1) (-6,6) (-4,4) (-2,2) (6,-6) (-3,3) (-6,6)

Two Players Rewritten - 5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,5) (4,-4) (1,-1) (-6,6) (-4,4) (-2,2) (6,-6) (-3,3) (-6,6) V(s) = (value of s to player 1, value of s to player 2)

Non-Zero Sum - 5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,-2) (4,5) (1,-1) (-6,4) (-4,5) (-2,3) (6,-5) (-3,3) (-6,9) Values no longer add up to 0

Non-Zero Sum - 5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,-2) (4,5) (1,-1) (-6,4) (-4,5) (-2,3) (6,-5) (-3,3) (-6,9) Value of a state for me is my number, opponent picks action based on his number

Non-Zero Sum - 5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,-2) (4,5) (1,-1) (-6,4) (-4,5) (-2,3) (6,-5) (-3,3) (-6,9) Best move for opponent could be mine, too

Non-Zero Sum - 5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,-2) (4,5) (1,-1) (-6,4) (-4,5) (-2,3) (6,-5) (-3,3) (-6,9) Value of a state for me is my number, opponent picks action based on his number

Non-Zero Sum - 4-5 +4 + 1-6 - 4-2 + 6-3 - 6 (-5,-2) (4,5) (1,-1) (-6,4) (-4,5) (-2,3) (6,-5) (-3,3) (-6,9) Value of a state for me is my number, opponent picks action based on his number

Three Players (-5,-1,5) (4,2,-1) (1,3,-1) (-6,2,6) (-4,1,4) (-2,3,2) (6,6,-6) (-3,0,3) (-6,-4,6) V(s) = (value of s to player 1, value of s to player 2, value of s to player 3)

More Generally V(s) = [v 1 (s),v 2 (s),,v n (s)] n = number of players v i (s) = value of s to player i Value of s for me is v 1 (s) [assuming I m player 1] If it is player i s turn, the best move will maximize v i (s) Opponent will do what s best for opponent May not be the worst for me! Ignores collaboration other than what arises from the v i

Ordering / Pruning Branches Time complexity for minimax search is O(b m ) Branching factor b Tree depth m Using alpha-beta pruning Best case: O b m 2 b m 2 is equivalent to b m Random order: roughly O b 3m 4

Ordering / Pruning Branches Iterative Deepening: Keep track of best move on each iteration Do the best moves first on the next iteration Transposition tables: Generalization of checking for revisited states in search Can take into account symmetries These maintain game tree search outcomes (except for ties) if searching all the way to terminals nodes

Ordering / Pruning Branches Forward Pruning - ProbCut: More aggressive than alpha-beta pruning Keep statistics on move variability, do shallow search to compute an estimate of V, then prune it if a state with that value at that depth is highly probable to be outside of the interval (alpha,beta) Null move: Let opponent make two moves first to get an initial value for beta These are heuristic, in that they might prune good paths