Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.

Slides:



Advertisements
Similar presentations
Chapter 6, Sec Adversarial Search.
Advertisements

Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4. Warm Up Let’s play some games!
CMSC 671 Fall 2001 Class #8 – Thursday, September 27.
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Solving Problems by Searching Paula Matuszek Spring, 2010 Slides based on Hwee Tou.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
COMP-4640: Intelligent & Interactive Systems Game Playing A game can be formally defined as a search problem with: -An initial state -a set of operators.
1 Game Playing. 2 Outline Perfect Play Resource Limits Alpha-Beta pruning Games of Chance.
Adversarial Search Game Playing Chapter 6. Outline Games Perfect Play –Minimax decisions –α-β pruning Resource Limits and Approximate Evaluation Games.
Adversarial Search CSE 473 University of Washington.
Adversarial Search Chapter 6.
Artificial Intelligence for Games Game playing Patrick Olivier
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
An Introduction to Artificial Intelligence Lecture VI: Adversarial Search (Games) Ramin Halavati In which we examine problems.
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
EIE426-AICV 1 Game Playing Filename: eie426-game-playing-0809.ppt.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
CMSC 463 Chapter 5: Game Playing Prof. Adam Anthony.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
CSC 412: AI Adversarial Search
CHAPTER 6 : ADVERSARIAL SEARCH
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
1 Game Playing Why do AI researchers study game playing? 1.It’s a good reasoning problem, formal and nontrivial. 2.Direct comparison with humans and other.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Notes on Game Playing by Yun Peng of theYun Peng University of Maryland Baltimore County.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Paula Matuszek, CSC 8520, Fall Based in part on aima.eecs.berkeley.edu/slides-ppt 1 CS 8520: Artificial Intelligence Adversarial Search Paula Matuszek.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides)
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Adversarial Search and Game Playing. Topics Game playing Game trees Minimax Alpha-beta pruning Examples.
Adversarial Search Chapter 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
Adversarial Search CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and Java.
Chapter 5 Adversarial Search. 5.1 Games Why Study Game Playing? Games allow us to experiment with easier versions of real-world situations Hostile agents.
5/4/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 9, 5/4/2005 University of Washington, Department of Electrical Engineering Spring 2005.
Game Playing Why do AI researchers study game playing?
Game Playing Why do AI researchers study game playing?
EA C461 – Artificial Intelligence Adversarial Search
Adversarial Search Chapter 5.
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
CMSC 471 Fall 2011 Class #8-9 Tue 9/27/11 – Thu 9/29/11 Game Playing
Games & Adversarial Search
Games & Adversarial Search
Game Playing: Adversarial Search
CMSC 671 Fall 2010 Tue 9/21/10 Game Playing
Game Playing Fifth Lecture 2019/4/11.
Game Playing: Adversarial Search
Game Playing Chapter 5.
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4.
Presentation transcript:

Adversarial Search Chapter 6 Section 1 – 4

Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What if there are TWO agents? Goals in conflict: –Adversarial Search Especially common in AI: –Goals in direct conflict –IE: GAMES.

Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits  unlikely to find goal, must approximate Efficiency matters a lot HARD. In AI, typically "zero sum": one player wins exactly as much as other player loses.

Types of games Deterministic Chance Perfect Info Chess, Monopoly Checkers Backgammon Othello Tic-Tac-Toe Imperfect Info Bridge Poker Scrabble

Tic-Tac-Toe Tic Tac Toe is one of the classic AI examples. Let's play some. Tic Tac Toe version 1. Tic Tac Toe version 2. Try them both, at various levels of difficulty. –What kind of strategy are you using? –What kind does the computer seem to be using? –Did you win? Lose?

Problem Definition Formally define a two-person game as: Two players, called MAX and MIN. –Alternate moves –At end of game winner is rewarded and loser penalized. Game has –Initial State: board position and player to go first –Successor Function: returns (move, state) pairs All legal moves from the current state Resulting state –Terminal Test –Utility function for terminal states. Initial state plus legal moves define game tree.

Tic Tac Toe Game tree

Optimal Strategies Optimal strategy is sequence of moves leading to desired goal state. MAX's strategy is affected by MIN's play. So MAX needs a strategy which is the best possible payoff, assuming optimal play on MIN's part. Determined by looking at MINIMAX value for each node in game tree.

Minimax Perfect play for deterministic games Idea: choose move to position with highest minimax value = best achievable payoff against best play E.g., 2-ply game:

Minimax algorithm

Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(b m ) Space complexity? O(bm) (depth-first exploration) For chess, b ≈ 35, m ≈100 for "reasonable" games  exact solution completely infeasible Even tic-tac-toe is much too complex to diagram here, although it's small enough to implement.

Pruning the Search “If you have an idea that is surely bad, don't take the time to see how truly awful it is.” -- Pat Winston Minimax exponential with # of moves; not feasible in real-life But we can PRUNE some branches. Alpha-Beta pruning –If it is clear that a branch can't improve on the value we already have, stop analysis.

α-β pruning example

Properties of α-β Pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(b m/2 )  doubles depth of search which can be carried out for a given level of resources. A simple example of the value of reasoning about which computations are relevant (a form of metareasoning)

Why is it called α-β? α is the value of the best (i.e., highest- value) choice found so far at any choice point along the path for max If v is worse than α, max will avoid it  prune that branch Define β similarly for min

The α-β algorithm

"Informed" Search Alpha-Beta still not feasible for large game spaces. Can we improve on performance with domain knowledge? Yes -- if we have a useful heuristic for evaluating game states. Conceptually analogous to A* for single- agent search.

Resource limits Suppose we have 100 secs, explore 10 4 nodes/sec  10 6 nodes per move Standard approach: cutoff test: e.g., depth limit (perhaps add quiescence search) evaluation function = estimated desirability of position

Evaluation function Evaluation function or static evaluator is used to evaluate the “goodness” of a game position. –Contrast with heuristic search where the evaluation function was a non-negative estimate of the cost from the start node to a goal and passing through the given node The zero-sum assumption allows us to use a single evaluation function to describe the goodness of a board with respect to both players. –f(n) >> 0: position n good for me and bad for you –f(n) << 0: position n bad for me and good for you –f(n) near 0: position n is a neutral position –f(n) = +infinity: win for me –f(n) = -infinity: win for you DesJardins:

Evaluation function examples Example of an evaluation function for Tic-Tac-Toe: f(n) = [# of 3-lengths open for me] - [# of 3-lengths open for you] where a 3-length is a complete row, column, or diagonal Alan Turing’s function for chess –f(n) = w(n)/b(n) where w(n) = sum of the point value of white’s pieces and b(n) = sum of black’s Most evaluation functions are specified as a weighted sum of position features: f(n) = w 1 *feat 1 (n) + w 2 *feat 2 (n) w n *feat k (n) Example features for chess are piece count, piece placement, squares controlled, etc. Deep Blue (which beat Gary Kasparov in 1997) had over 8000 features in its evaluation function DesJardins:

Cutting off search MinimaxCutoff is identical to MinimaxValue except 1.Terminal? is replaced by Cutoff? 2.Utility is replaced by Eval Does it work in practice? For chess: b m = 10 6, b=35  m=4 4-ply lookahead is a hopeless chess player! –4-ply ≈ human novice –8-ply ≈ typical PC, human master –12-ply ≈ Deep Blue, Kasparov

Deterministic games in practice Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions. Chess: Deep Blue defeated human world champion Garry Kasparov in a six-game match in Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply. Othello: human champions refuse to compete against computers, who are too good. Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves.

Games of chance Backgammon is a two-player game with uncertainty. Players roll dice to determine what moves to make. White has just rolled 5 and 6 and has four legal moves: 5-10, , , , Such games are good for exploring decision making in adversarial problems involving skill and luck. DesJardins:

Decision-Making in Non- Deterministic Games Probable state tree will depend on chance as well as moves chosen Add "chance" notes to the max and min nodes. Compute expected values for chance nodes.

Game Trees with Chance Nodes Chance nodes (shown as circles) represent random events For a random event with N outcomes, each chance node has N distinct children; a probability is associated with each (For 2 dice, there are 21 distinct outcomes) Use minimax to compute values for MAX and MIN nodes Use expected values for chance nodes For chance nodes over a max node, as in C: expectimax(C) = ∑ i (P(d i ) * maxvalue(i)) For chance nodes over a min node: expectimin(C) = ∑ i (P(d i ) * minvalue(i)) Max Rolls Min Rolls DesJardins:

Meaning of the evaluation function Dealing with probabilities and expected values means we have to be careful about the “meaning” of values returned by the static evaluator. Note that a “relative-order preserving” change of the values would not change the decision of minimax, but could change the decision with chance nodes. Linear transformations are OK A1 is best move A2 is best move 2 outcomes with prob {.9,.1} DesJardins:

Summary Games are fun to work on! They illustrate several important points about AI perfection is unattainable  must approximate good idea to think about what to think about