adversarial search
play

Adversarial Search Robert Platt Northeastern University Some - PowerPoint PPT Presentation

Adversarial Search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley 2. RN, AIMA What is adversarial search? Adversarial search: planning used to play a game such as chess or checkers


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

  2. What is adversarial search? Adversarial search: planning used to play a game such as chess or checkers – algorithms are similar to graph search except that we plan under the assumption that our opponent will maximize his own advantage...

  3. Examples of adversarial search Chess Checkers Tic-tac-toe Go

  4. Examples of adversarial search Chess Solved/unsolved? Checkers Solved/unsolved? Tic-tac-toe Solved/unsolved? Go Solved/unsolved? Outcome of game can be predicted from any initial state assuming both players play perfectly

  5. Examples of adversarial search Chess Unsolved Checkers Solved Tic-tac-toe Solved Go Unsolved Outcome of game can be predicted from any initial state assuming both players play perfectly

  6. Examples of adversarial search Chess Unsolved ~10^40 states Checkers Solved ~10^20 states Tic-tac-toe Solved Less than 9!=362k states Go Unsolved ? Outcome of game can be predicted from any initial state assuming both players play perfectly

  7. Different types of games Deterministic / stochastic Two player / multi player? Zero-sum / non zero-sum Fully observable / partially observable

  8. What is a zero-sum game? Zero-sum: • Sum of utilities is zero • In the case of a two player game: • Pure competition Not zero-sum: • Agents have arbitrary utilities • Might induce cooperation or competition

  9. A formal definition of a deterministic game Problem: State set: S (start at s0) Players: P={1...N} (usually take turns) Action set: A Transition Function: SxA -> S Terminal Test: S -> {t,f} Terminal Utilities: SxP -> R Solution: Policy, S -> A Objective: Find an optimal policy – a policy that maximizes utility assuming that adversary acts optimally.

  10. A formal definition of a deterministic game Problem: State set: S (start at s0) Players: P={1...N} (usually take turns) Action set: A Transition Function: SxA -> S How is this similar/different Terminal Test: S -> {t,f} to the def'n of a standard Terminal Utilities: SxP -> R search problem? Solution: Policy, S -> A Objective: Find an optimal policy – a policy that maximizes utility assuming that adversary acts optimally.

  11. A formal definition of a deterministic game Problem: State set: S (start at s0) Players: P={1...N} (usually take turns) Action set: A Transition Function: SxA -> S How do we solve Terminal Test: S -> {t,f} this problem? Terminal Utilities: SxP -> R Solution: Policy, S -> A Objective: Find an optimal policy – a policy that maximizes utility assuming that adversary acts optimally.

  12. Adversarial search Image: Berkeley CS188 course notes (downloaded Summer 2015)

  13. This is a game tree for tic-tac-toe Images: AIMA, Berkeley CS188 course notes (downloaded Summer 2015)

  14. This is a game tree for tic-tac-toe You Images: AIMA, Berkeley CS188 course notes (downloaded Summer 2015)

  15. This is a game tree for tic-tac-toe You Them Images: AIMA, Berkeley CS188 course notes (downloaded Summer 2015)

  16. This is a game tree for tic-tac-toe You Them You Images: AIMA, Berkeley CS188 course notes (downloaded Summer 2015)

  17. This is a game tree for tic-tac-toe You Them You Them Images: AIMA, Berkeley CS188 course notes (downloaded Summer 2015)

  18. This is a game tree for tic-tac-toe You Them You Them Utility Images: AIMA, Berkeley CS188 course notes (downloaded Summer 2015)

  19. What is Minimax? Consider a simple game: 1. you make a move 2. your opponent makes a move 3. game ends

  20. What is Minimax? Consider a simple game: What does the minimax tree 1. you make a move look like in this case? 2. your opponent makes a move 3. game ends

  21. What is Minimax? Consider a simple game: What does the minimax tree 1. you make a move look like in this case? 2. your opponent makes a move 3. game ends Max (you) Min (them) Max 3 12 8 2 4 6 14 5 2 (you)

  22. What is Minimax? Max (you) Min (them) Max 3 12 8 2 4 6 14 5 2 (you) These are terminal utilities – assume we know what these values are

  23. What is Minimax? Max (you) Min 3 2 2 (them) Max 3 12 8 2 4 6 14 5 2 (you)

  24. What is Minimax? 3 Max Max (you) (you) Min Min 3 2 2 (them) (them) Max 3 12 8 2 4 6 14 5 2 (you)

  25. What is Minimax? 3 Max (you) This is called “backing up” Min 3 2 2 the values (them) Max 3 12 8 2 4 6 14 5 2 (you)

  26. What is Minimax? Okay – so we know how to back up values ... … but, how do we construct the tree? 3 12 8 2 4 6 14 5 2 This tree is already built...

  27. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense.

  28. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense.

  29. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3

  30. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3 12

  31. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3 12 8

  32. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3 3 12 8

  33. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3 3 12 8

  34. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3 2 3 12 8 2 4 6

  35. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. 3 3 2 2 3 12 8 2 4 6 14 5 2

  36. What is Minimax? Notice that we only get utilities at the bottom of the tree … – therefore, DFS makes sense. – since most games have forward progress, the distinction between tree search and graph search is less important

  37. What is Minimax?

  38. Minimax properties Is it always correct to assume your opponent plays optimally? max min 10 10 9 100 Slide: Berkeley CS188 course notes (downloaded Summer 2015)

  39. Minimax vs “expectimax” Slide: Berkeley CS188 course notes (downloaded Summer 2015)

  40. Minimax vs “expectimax” Slide: Berkeley CS188 course notes (downloaded Summer 2015)

  41. Minimax properties Is minimax optimal? Is it complete?

  42. Minimax properties Is minimax optimal? Is it complete? Time complexity = ? Space complexity = ?

  43. Minimax properties Is minimax optimal? Is it complete? Time complexity = Space complexity =

  44. Minimax properties Is minimax optimal? Is it complete? Time complexity = Space complexity = Is it practical? In chess, b=35, d=100

  45. Minimax properties Is minimax optimal? Is it complete? Time complexity = Space complexity = Is it practical? In chess, b=35, d=100 is a big number...

  46. Minimax properties Is minimax optimal? Is it complete? Time complexity = Space complexity = Is it practical? In chess, b=35, d=100 is a big number... So what can we do?

  47. Evaluation functions Key idea: cut off search at a certain depth and give the corresponding nodes an estimated value. 4 -2 4 -1 -2 4 9 Cut it off here ? ? ? ? Image: Berkeley CS188 course notes (downloaded Summer 2015)

  48. Evaluation functions Key idea: cut off search at a certain depth and give the corresponding nodes an estimated value. 4 -2 4 the evaluation function makes this estimate. -1 -2 4 9 Cut it off here ? ? ? ? Image: Berkeley CS188 course notes (downloaded Summer 2015)

  49. Evaluation functions How does the evaluation function make the estimate? – depends upon domain For example, in chess, the value of a state might equal the sum of piece values. – a pawn counts for 1 – a rook counts for 5 – a knight counts for 3 ...

  50. A weighted linear evaluation function number of pawns on the board number of knights on the board A pawn counts for 1 A knight counts for 3

  51. At what depth do you run the evaluation function? 4 Option 1: cut off search at a fixed depth -2 4 -1 -2 4 9 Option 2: cut off search at quiescient states deeper than a certain threshold Option 3: ? The deeper your threshold, the less the quality of the evaluation function matters... ? ? ? ?

  52. At what depth do you run the evaluation function? Search depth=2 Slide: Berkeley CS188 course notes (downloaded Summer 2015)

  53. At what depth do you run the evaluation function? Search depth=10 Slide: Berkeley CS188 course notes (downloaded Summer 2015)

  54. Alpha/Beta pruning Image: Berkeley CS188 course notes (downloaded Summer 2015)

  55. Alpha/Beta pruning 3 3 12 8

  56. Alpha/Beta pruning 3 3 12 8

  57. Alpha/Beta pruning 3 3 12 8 2

  58. Alpha/Beta pruning 3 3 12 8 2 4

  59. Alpha/Beta pruning 3 We don't need to expand this node! 3 12 8 2 4

  60. Alpha/Beta pruning 3 We don't need to expand this node! Why? 3 12 8 2 4

Recommend


More recommend