CS325 Artificial Intelligence Ch. 5, Games!

Similar documents
Adversarial Search 1

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence. Overview

School of EECS Washington State University. Artificial Intelligence

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

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

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

Artificial Intelligence

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

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

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

Artificial Intelligence

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

Programming Project 1: Pacman (Due )

Artificial Intelligence

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

CS 188: Artificial Intelligence

Artificial Intelligence

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

Game Playing State-of-the-Art

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

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

CS 5522: Artificial Intelligence II

Adversarial Search and Game Playing

Lecture 5: Game Playing (Adversarial Search)

CS 380: ARTIFICIAL INTELLIGENCE

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

CSE 473: Artificial Intelligence Autumn 2011

CSE 573: Artificial Intelligence Autumn 2010

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

CS 188: Artificial Intelligence Spring 2007

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

Game Playing: Adversarial Search. Chapter 5

Adversarial Search Lecture 7

Game Playing. Philipp Koehn. 29 September 2015

Game playing. Chapter 6. Chapter 6 1

ARTIFICIAL INTELLIGENCE (CS 370D)

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

CS 188: Artificial Intelligence Spring Game Playing in Practice

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

Game playing. Chapter 6. Chapter 6 1

CSE 573: Artificial Intelligence

ADVERSARIAL SEARCH. Chapter 5

Game playing. Chapter 5. Chapter 5 1

Adversarial search (game playing)

CSE 473: Artificial Intelligence. Outline

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

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

Artificial Intelligence

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

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

Game playing. Outline

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

Games and Adversarial Search

Ar#ficial)Intelligence!!

CS 188: Artificial Intelligence

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

Artificial Intelligence Adversarial Search

Game playing. Chapter 5, Sections 1 6

Game-Playing & Adversarial Search

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

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

Data Structures and Algorithms

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

Artificial Intelligence. Minimax and alpha-beta pruning

Adversarial Search. CMPSCI 383 September 29, 2011

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

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

Artificial Intelligence 1: game playing

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

CS 331: Artificial Intelligence Adversarial Search II. Outline

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

CS 4700: Artificial Intelligence

CS 771 Artificial Intelligence. Adversarial Search

Game Playing AI Class 8 Ch , 5.4.1, 5.5

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

Game Engineering CS F-24 Board / Strategy Games

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

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

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

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

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

Intuition Mini-Max 2

Game Playing Part 1 Minimax Search

Foundations of Artificial Intelligence

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

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

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

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

CS 4700: Foundations of Artificial Intelligence

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

Game Playing State of the Art

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

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

Adversarial Search (Game Playing)

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

Games (adversarial search problems)

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

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

Transcription:

CS325 Artificial Intelligence Ch. 5, Games! Cengiz Günay, Emory Univ. vs. Spring 2013 Günay Ch. 5, Games! Spring 2013 1 / 19

AI in Games A lot of work is done on it. Why? Günay Ch. 5, Games! Spring 2013 2 / 19

AI in Games A lot of work is done on it. Why? Fun, provide entertainment Also, simpler than life: toy problems Günay Ch. 5, Games! Spring 2013 2 / 19

AI in Games A lot of work is done on it. Why? Fun, provide entertainment Also, simpler than life: toy problems Types of game AIs: Günay Ch. 5, Games! Spring 2013 2 / 19

AI in Games A lot of work is done on it. Why? Fun, provide entertainment Also, simpler than life: toy problems Types of game AIs: Adversaries zerg rush Günay Ch. 5, Games! Spring 2013 2 / 19

AI in Games A lot of work is done on it. Why? Fun, provide entertainment Also, simpler than life: toy problems Types of game AIs: Adversaries Simulated reality (non-playable characters, world reaction to player). zerg rush Günay Ch. 5, Games! Spring 2013 2 / 19

AI in Games A lot of work is done on it. Why? Fun, provide entertainment Also, simpler than life: toy problems Types of game AIs: Adversaries Simulated reality (non-playable characters, world reaction to player). Game theory (next class) zerg rush Günay Ch. 5, Games! Spring 2013 2 / 19

Entry/Exit Surveys Exit survey: Hidden Markov Models In the mining robot example, when is the uncertainty of the robot s trajectories reduced? How is Particle Filtering like and unlike a water filter? Entry survey: Adversarial Games (0.25 points of final grade) What algorithm would be useful in games? Give examples with two different algorithms you learned in class. How would you help an agent solve a problem against an adversary? Think of a game like chess or checkers for starters. Günay Ch. 5, Games! Spring 2013 3 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: board game with complex rules (Machinarium) Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: board game with complex rules (Machinarium) MDPs, Reinforcement Learning: Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: board game with complex rules (Machinarium) MDPs, Reinforcement Learning: pathfinding, optimal strategy for zerg Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: board game with complex rules (Machinarium) MDPs, Reinforcement Learning: pathfinding, optimal strategy for zerg HMMs, Particle Filter: Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: board game with complex rules (Machinarium) MDPs, Reinforcement Learning: pathfinding, optimal strategy for zerg HMMs, Particle Filter: state estimation and future prediction, partially observable environment with traps (sonic?) Günay Ch. 5, Games! Spring 2013 4 / 19

Previously on AI for Games... Can previous algorithms help in games? Single-state agent: vacuum world, solving a maze Bayes Nets: card games Machine Learning: guessing games, learning user moves Logic, planning: board game with complex rules (Machinarium) MDPs, Reinforcement Learning: pathfinding, optimal strategy for zerg HMMs, Particle Filter: state estimation and future prediction, partially observable environment with traps (sonic?) None for adversaries? Günay Ch. 5, Games! Spring 2013 4 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game Chess, Checkers Robot Soccer Poker Hide-and-go-seek Starcraft Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers Robot Soccer Poker Hide-and-go-seek Starcraft Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer Poker Hide-and-go-seek Starcraft Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer X X Poker Hide-and-go-seek Starcraft Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer X X Poker X X X X Hide-and-go-seek Starcraft Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer X X Poker X X X X Hide-and-go-seek X X Starcraft Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer X X Poker X X X X Hide-and-go-seek X X Starcraft X X X Battle for Wesnoth Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer X X Poker X X X X Hide-and-go-seek X X Starcraft X X X Battle for Wesnoth X X X Halo/CoD/MoH Solitaire Minesweeper Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Properties of Games as Agent Environment Stochastic Part.-Observ. Unknown Adversarial Game X Chess, Checkers X X X Robot Soccer X X Poker X X X X Hide-and-go-seek X X Starcraft X X X Battle for Wesnoth X X X Halo/CoD/MoH X Solitaire X Minesweeper X Zuma Günay Ch. 5, Games! Spring 2013 5 / 19

Single Player Games Deterministic, single-state agent Single-player game using tree search initial state player state possible actions results of actions utility values goal test Günay Ch. 5, Games! Spring 2013 6 / 19

Adversarial Games Adversarial Games 1 Start by adapting single-state agent to games 2 Define adversary as someone who wants you to lose 3 And makes decisions based on the outcome of your moves Günay Ch. 5, Games! Spring 2013 7 / 19

Adversarial Games Adversarial Games 1 Start by adapting single-state agent to games 2 Define adversary as someone who wants you to lose 3 And makes decisions based on the outcome of your moves 2-player games: Deterministic Zero-sum: Reward distributed between players Minimax algorithm: max & min players choose +/- utility, resp. Günay Ch. 5, Games! Spring 2013 7 / 19

Adversarial Games Adversarial Games 1 Start by adapting single-state agent to games 2 Define adversary as someone who wants you to lose 3 And makes decisions based on the outcome of your moves 2-player games: Deterministic Zero-sum: Reward distributed between players Minimax algorithm: max & min players choose +/- utility, resp. Günay Ch. 5, Games! Spring 2013 7 / 19

2-Player Value Function defun value(s): if s is : U(s) if s is : maxvalue(s) if s is : minvalue(s) Günay Ch. 5, Games! Spring 2013 8 / 19

2-Player Value Function defun value(s): if s is : U(s) if s is : maxvalue(s) if s is : minvalue(s) defun m = maxvalue(s): m = for (a, s ) in successors(s): v = value(s ) m = maxvalue(m, v) Günay Ch. 5, Games! Spring 2013 8 / 19

2-Player Value Function defun value(s): if s is : U(s) if s is : maxvalue(s) if s is : minvalue(s) defun m = maxvalue(s): m = for (a, s ) in successors(s): v = value(s ) m = maxvalue(m, v) Assumes opponent is perfect! Günay Ch. 5, Games! Spring 2013 8 / 19

Time Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) Günay Ch. 5, Games! Spring 2013 9 / 19

Time Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) Günay Ch. 5, Games! Spring 2013 9 / 19

Time Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) For chess: b 30, m 40 How long would it take with: 1 billion processors 1 billion/s evals? 1 seconds 2 minutes 3 hours 4 years 5 forever Günay Ch. 5, Games! Spring 2013 9 / 19

Time Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) For chess: b 30, m 40 How long would it take with: 1 billion processors 1 billion/s evals? 1 seconds 2 minutes 3 hours 4 years 5 forever Günay Ch. 5, Games! Spring 2013 9 / 19

Space Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) Günay Ch. 5, Games! Spring 2013 10 / 19

Space Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) Günay Ch. 5, Games! Spring 2013 10 / 19

Space Complexity For a tree with branching factor, b, and depth, m? 1 O(bm) 2 O(b m ) 3 O(m b ) Do not need more than total number of nodes. Günay Ch. 5, Games! Spring 2013 10 / 19

Complexity Reduction? How to do it? 1 Reduce b 2 Reduce m 3 Tree graph Günay Ch. 5, Games! Spring 2013 11 / 19

Complexity Reduction? How to do it? 1 Reduce b 2 Reduce m 3 Tree graph All of the above! Günay Ch. 5, Games! Spring 2013 11 / 19

Example defun value(s): if s is : U(s) if s is : maxvalue(s) if s is : minvalue(s) defun m = maxvalue(s): m = for (a, s ) in successors(s): v = value(s ) m = maxvalue(m, v) Günay Ch. 5, Games! Spring 2013 12 / 19

Example defun value(s): if s is : U(s) if s is : maxvalue(s) if s is : minvalue(s) defun m = maxvalue(s): m = for (a, s ) in successors(s): v = value(s ) m = maxvalue(m, v) Günay Ch. 5, Games! Spring 2013 12 / 19

Reducing Branching Factor, b Günay Ch. 5, Games! Spring 2013 13 / 19

Reducing Branching Factor, b Günay Ch. 5, Games! Spring 2013 13 / 19

Reducing Branching Factor, b Günay Ch. 5, Games! Spring 2013 13 / 19

Reducing Branching Factor, b Günay Ch. 5, Games! Spring 2013 13 / 19

Reducing Branching Factor, b Which one to prune? Günay Ch. 5, Games! Spring 2013 13 / 19

Reducing Depth, m Select a cutoff: Limit m (e.g., plan 3 steps ahead in chess) Estimate terminal nodes utility with evaluation function like heuristics Learn from experience In chess, use board state, value of pieces, etc. For value of pieces:eval(s) = i w ip i can use machine learning for w i Günay Ch. 5, Games! Spring 2013 14 / 19

Formalize as Alpha-Beta Pruning defun value(s): cutoff at depth m : eval(s) if s is : U(s) if s is : maxvalue(s, depth, α, β) if s is : minvalue(s, depth, α, β) where α, β are overall max and min values, resp. Günay Ch. 5, Games! Spring 2013 15 / 19

Formalize as Alpha-Beta Pruning defun value(s): cutoff at depth m : eval(s) if s is : U(s) if s is : maxvalue(s, depth, α, β) if s is : minvalue(s, depth, α, β) where α, β are overall max and min values, resp. defun v = maxvalue(s, depth, α, β): v = for (a, s ) in successors(s): v = max(v, value(s, depth + 1, α, β)) if v > β return v α = max(α, v) Günay Ch. 5, Games! Spring 2013 15 / 19

Formalize as Alpha-Beta Pruning defun value(s): cutoff at depth m : eval(s) if s is : U(s) if s is : maxvalue(s, depth, α, β) if s is : minvalue(s, depth, α, β) where α, β are overall max and min values, resp. defun v = maxvalue(s, depth, α, β): v = for (a, s ) in successors(s): v = max(v, value(s, depth + 1, α, β)) if v > β return v α = max(α, v) Günay Ch. 5, Games! Spring 2013 15 / 19

Formalize as Alpha-Beta Pruning defun value(s): cutoff at depth m : eval(s) if s is : U(s) if s is : maxvalue(s, depth, α, β) if s is : minvalue(s, depth, α, β) where α, β are overall max and min values, resp. defun v = maxvalue(s, depth, α, β): v = for (a, s ) in successors(s): v = max(v, value(s, depth + 1, α, β)) if v > β return v α = max(α, v) Can cut up to O(b m/2 )! Günay Ch. 5, Games! Spring 2013 15 / 19

Complexity Reduction by Tree Graph Convert into graph search problem: to reach special opening and closing states to make and protect from killer-moves Günay Ch. 5, Games! Spring 2013 16 / 19

Complexity Reduction by Tree Graph Convert into graph search problem: to reach special opening and closing states to make and protect from killer-moves Utility: How many food particles can pacman eat? Günay Ch. 5, Games! Spring 2013 16 / 19

Complexity Reduction by Tree Graph Convert into graph search problem: to reach special opening and closing states to make and protect from killer-moves Utility: How many food particles can pacman eat? Günay Ch. 5, Games! Spring 2013 16 / 19

Complexity Reduction by Tree Graph Convert into graph search problem: to reach special opening and closing states to make and protect from killer-moves Utility: How many food particles can pacman eat? 2-step limit causes horizon effect? Günay Ch. 5, Games! Spring 2013 16 / 19

Stochastic Games Günay Ch. 5, Games! Spring 2013 17 / 19

Stochastic Games defun value(s): cutoff at depth m : eval(s) if s is : U(s) if s is : maxvalue(s, depth, α, β) if s is : minvalue(s, depth, α, β) if s is?: expvalue(s, depth, α, β) Günay Ch. 5, Games! Spring 2013 18 / 19

Coin-flip Game Günay Ch. 5, Games! Spring 2013 19 / 19

Coin-flip Game Günay Ch. 5, Games! Spring 2013 19 / 19