Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm...
Transcript of Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm...
![Page 1: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/1.jpg)
CS 561, Sessions 8-9 1
Administrativia
• Assignment 1 due tuesday 9/23/2003 BEFORE midnight
• Midterm exam 10/09/2003
![Page 2: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/2.jpg)
CS 561, Sessions 8-9 2
Last time: search strategies
Uninformed: Use only information available in the problem formulation• Breadth-first• Uniform-cost• Depth-first• Depth-limited• Iterative deepening
Informed: Use heuristics to guide the search• Best first:• Greedy search – queue first nodes that maximize heuristic “desirability” based on
estimated path cost from current node to goal;• A* search – queue first nodes that maximize sum of path cost so far and estimated
path cost to goal.• Iterative improvement – keep no memory of path; work on a single current state and
iteratively improve its “value.”• Hill climbing – select as new current state the successor state which maximizes value.• Simulated annealing – refinement on hill climbing by which “bad moves” are
permitted, but with decreasing size and frequency. Will find global extremum.
![Page 3: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/3.jpg)
CS 561, Sessions 8-9 3
Exercise: Search Algorithms
The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.
Which node (use the node’s letter) will be expanded next by each of the following search algorithms?
(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search
(e) A* search
5
D
5
A
C
54
19
6
3
h=15
B
F GE
h=8h=12h=10 h=10
h=18
H
h=20
h=14
![Page 4: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/4.jpg)
CS 561, Sessions 8-9 4
Depth-first search
Node queue: initialization
# state depth path cost parent #
1 A 0 0 --
![Page 5: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/5.jpg)
CS 561, Sessions 8-9 5
Depth-first search
Node queue: add successors to queue front; empty queue from top
# state depth path cost parent #
2 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --
![Page 6: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/6.jpg)
CS 561, Sessions 8-9 6
Depth-first search
Node queue: add successors to queue front; empty queue from top
# state depth path cost parent #
5 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 22 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --
![Page 7: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/7.jpg)
CS 561, Sessions 8-9 7
Depth-first search
Node queue: add successors to queue front; empty queue from top
# state depth path cost parent #
5 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 22 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --
![Page 8: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/8.jpg)
CS 561, Sessions 8-9 8
Exercise: Search Algorithms
The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.
Which node (use the node’s letter) will be expanded next by each of the following search algorithms?
(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search
(e) A* search
5
D
5
A
C
54
19
6
3
h=15
B
F GE
h=8h=12h=10 h=10
h=18
H
h=20
h=14
![Page 9: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/9.jpg)
CS 561, Sessions 8-9 9
Breadth-first search
Node queue: initialization
# state depth path cost parent #
1 A 0 0 --
![Page 10: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/10.jpg)
CS 561, Sessions 8-9 10
Breadth-first search
Node queue: add successors to queue end; empty queue from top
# state depth path cost parent #
1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 1
![Page 11: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/11.jpg)
CS 561, Sessions 8-9 11
Breadth-first search
Node queue: add successors to queue end; empty queue from top
# state depth path cost parent #
1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 2
![Page 12: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/12.jpg)
CS 561, Sessions 8-9 12
Breadth-first search
Node queue: add successors to queue end; empty queue from top
# state depth path cost parent #
1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 2
![Page 13: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/13.jpg)
CS 561, Sessions 8-9 13
Exercise: Search Algorithms
The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.
Which node (use the node’s letter) will be expanded next by each of the following search algorithms?
(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search
(e) A* search
5
D
5
A
C
54
19
6
3
h=15
B
F GE
h=8h=12h=10 h=10
h=18
H
h=20
h=14
![Page 14: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/14.jpg)
CS 561, Sessions 8-9 14
Uniform-cost search
Node queue: initialization
# state depth path cost parent #
1 A 0 0 --
![Page 15: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/15.jpg)
CS 561, Sessions 8-9 15
Uniform-cost search
Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top
# state depth path cost parent #
1 A 0 0 --2 B 1 3 13 D 1 5 14 C 1 19 1
![Page 16: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/16.jpg)
CS 561, Sessions 8-9 16
Uniform-cost search
Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top
# state depth path cost parent #
1 A 0 0 --2 B 1 3 13 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 24 C 1 19 1
![Page 17: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/17.jpg)
CS 561, Sessions 8-9 17
Uniform-cost search
Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top
# state depth path cost parent #
1 A 0 0 --2 B 1 3 13 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 24 C 1 19 1
![Page 18: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/18.jpg)
CS 561, Sessions 8-9 18
Exercise: Search Algorithms
The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.
Which node (use the node’s letter) will be expanded next by each of the following search algorithms?
(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search
(e) A* search
5
D
5
A
C
54
19
6
3
h=15
B
F GE
h=8h=12h=10 h=10
h=18
H
h=20
h=14
![Page 19: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/19.jpg)
CS 561, Sessions 8-9 19
Greedy search
Node queue: initialization
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --
![Page 20: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/20.jpg)
CS 561, Sessions 8-9 20
Greedy search
Node queue: Add successors to queue, sorted by cost to goal.
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --2 B 1 3 14 17 13 D 1 5 15 20 14 C 1 19 18 37 1
Sort key
![Page 21: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/21.jpg)
CS 561, Sessions 8-9 21
Greedy search
Node queue: Add successors to queue, sorted by cost to goal.
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 27 E 2 7 10 17 26 H 2 9 10 19 28 F 2 8 12 20 23 D 1 5 15 20 14 C 1 19 18 37 1
![Page 22: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/22.jpg)
CS 561, Sessions 8-9 22
Greedy search
Node queue: Add successors to queue, sorted by cost to goal.
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 27 E 2 7 10 17 26 H 2 9 10 19 28 F 2 8 12 20 23 D 1 5 15 20 14 C 1 19 18 37 1
![Page 23: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/23.jpg)
CS 561, Sessions 8-9 23
Exercise: Search Algorithms
The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.
Which node (use the node’s letter) will be expanded next by each of the following search algorithms?
(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search
(e) A* search
5
D
5
A
C
54
19
6
3
h=15
B
F GE
h=8h=12h=10 h=10
h=18
H
h=20
h=14
![Page 24: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/24.jpg)
CS 561, Sessions 8-9 24
A* search
Node queue: initialization
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --
![Page 25: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/25.jpg)
CS 561, Sessions 8-9 25
A* search
Node queue: Add successors to queue, sorted by total cost.
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --2 B 1 3 14 17 13 D 1 5 15 20 14 C 1 19 18 37 1
Sort key
![Page 26: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/26.jpg)
CS 561, Sessions 8-9 26
A* search
Node queue: Add successors to queue front, sorted by total cost.
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 26 E 2 7 10 17 27 H 2 9 10 19 23 D 1 5 15 20 18 F 2 8 12 20 24 C 1 19 18 37 1
![Page 27: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/27.jpg)
CS 561, Sessions 8-9 27
A* search
Node queue: Add successors to queue front, sorted by total cost.
# state depth path cost total parent #cost to goal cost
1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 26 E 2 7 10 17 27 H 2 9 10 19 23 D 1 5 15 20 18 F 2 8 12 20 24 C 1 19 18 37 1
![Page 28: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/28.jpg)
CS 561, Sessions 8-9 28
Exercise: Search Algorithms
The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.
Which node (use the node’s letter) will be expanded next by each of the following search algorithms?
(a) Depth-first search(b) Breadth-first search(c) Uniform-cost search(d) Greedy search
(e) A* search
5
D
5
A
C
54
19
6
3
h=15
B
F GE
h=8h=12h=10 h=10
h=18
H
h=20
h=14
![Page 29: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/29.jpg)
CS 561, Sessions 8-9 29
Last time: Simulated annealing algorithm
• Idea: Escape local extrema by allowing “bad moves,” but gradually decrease their size and frequency.
Note: goal here is tomaximize E.-
![Page 30: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/30.jpg)
CS 561, Sessions 8-9 30
Last time: Simulated annealing algorithm
• Idea: Escape local extrema by allowing “bad moves,” but gradually decrease their size and frequency.
Algorithm when goalis to minimize E.< -
-
![Page 31: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/31.jpg)
CS 561, Sessions 8-9 31
This time: Outline
• Game playing• The minimax algorithm• Resource limitations• alpha-beta pruning• Elements of chance
![Page 32: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/32.jpg)
CS 561, Sessions 8-9 32
What kind of games?
• Abstraction: To describe a game we must capture every relevant aspect of the game. Such as:• Chess• Tic-tac-toe• …
• Accessible environments: Such games are characterized by perfect information
• Search: game-playing then consists of a search through possible game positions
• Unpredictable opponent: introduces uncertainty thus game-playing must deal with contingency problems
![Page 33: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/33.jpg)
CS 561, Sessions 8-9 33
Searching for the next move
• Complexity: many games have a huge search space• Chess: b = 35, m=100 ⇒ nodes = 35 100
if each node takes about 1 ns to explorethen each move will take about 10 50 millenniato calculate.
• Resource (e.g., time, memory) limit: optimal solution not feasible/possible, thus must approximate
1. Pruning: makes the search more efficient by discarding portions of the search tree that cannot improve quality result.
2. Evaluation functions: heuristics to evaluate utility of a state without exhaustive search.
![Page 34: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/34.jpg)
CS 561, Sessions 8-9 34
Two-player games
• A game formulated as a search problem:
• Initial state: ?• Operators: ?• Terminal state: ?• Utility function: ?
![Page 35: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/35.jpg)
CS 561, Sessions 8-9 35
Two-player games
• A game formulated as a search problem:
• Initial state: board position and turn• Operators: definition of legal moves• Terminal state: conditions for when game is over• Utility function: a numeric value that describes the outcome of the
game. E.g., -1, 0, 1 for loss, draw, win.(AKA payoff function)
![Page 36: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/36.jpg)
CS 561, Sessions 8-9 36
Game vs. search problem
![Page 37: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/37.jpg)
CS 561, Sessions 8-9 37
Example: Tic-Tac-Toe
![Page 38: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/38.jpg)
CS 561, Sessions 8-9 38
Type of games
![Page 39: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/39.jpg)
CS 561, Sessions 8-9 39
Type of games
![Page 40: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/40.jpg)
CS 561, Sessions 8-9 40
The minimax algorithm
• Perfect play for deterministic environments with perfect information
• Basic idea: choose move with highest minimax value= best achievable payoff against best play
• Algorithm:1. Generate game tree completely2. Determine utility of each terminal state3. Propagate the utility values upward in the three by applying
MIN and MAX operators on the nodes in the current level4. At the root node use minimax decision to select the move with
the max (of the min) utility value
• Steps 2 and 3 in the algorithm assume that the opponent will play perfectly.
![Page 41: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/41.jpg)
CS 561, Sessions 8-9 41
Generate Game Tree
![Page 42: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/42.jpg)
CS 561, Sessions 8-9 42
Generate Game Tree
x x x
x
![Page 43: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/43.jpg)
CS 561, Sessions 8-9 43
Generate Game Tree
x
xo
o
x
o
xox
![Page 44: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/44.jpg)
CS 561, Sessions 8-9 44
Generate Game Tree
x
xo
o
x
o
xox
1 ply
1 move
![Page 45: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/45.jpg)
CS 561, Sessions 8-9 45
A subtree
win
lose
draw
xxo
o
ox
xxo
o
ox
xxo
o
oxx
xxo
o
ox
x x
xxo
o
oxx
xxo
o
oxx
xxo
o
ox
x
xxo
o
ox
x
xxo
o
ox
x
xxo
o
ox
xo
oo oo
o
xxo
o
oxx
o x xxx
xxo
o
oxx
o
xxo
o
ox
xo
xxo
o
ox
xo x
xxo
o
ox
xo
![Page 46: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/46.jpg)
CS 561, Sessions 8-9 46
What is a good move?
win
lose
draw
xxo
o
ox
xxo
o
ox
xxo
o
oxx
xxo
o
ox
x x
xxo
o
oxx
xxo
o
oxx
xxo
o
ox
x
xxo
o
ox
x
xxo
o
ox
x
xxo
o
ox
xo
oo oo
o
xxo
o
oxx
o x xx
xxo
o
ox
xo
xxo
o
ox
xo x
xxo
o
ox
xo
![Page 47: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/47.jpg)
CS 561, Sessions 8-9 47
Minimax
3 812 4 6 14 252
•Minimize opponent’s chance•Maximize your chance
![Page 48: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/48.jpg)
CS 561, Sessions 8-9 48
Minimax
3 2
3
2
812 4 6 14 252
MIN
•Minimize opponent’s chance•Maximize your chance
![Page 49: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/49.jpg)
CS 561, Sessions 8-9 49
Minimax
3
3
2
3
2
812 4 6 14 252
MAX
MIN
•Minimize opponent’s chance•Maximize your chance
![Page 50: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/50.jpg)
CS 561, Sessions 8-9 50
Minimax
3
3
2
3
2
812 4 6 14 252
MAX
MIN
•Minimize opponent’s chance•Maximize your chance
![Page 51: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/51.jpg)
CS 561, Sessions 8-9 51
minimax = maximum of the minimum
1st ply
2nd ply
![Page 52: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/52.jpg)
CS 561, Sessions 8-9 52
Minimax: Recursive implementation
Complete: ?Optimal: ?
Time complexity: ?Space complexity: ?
![Page 53: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/53.jpg)
CS 561, Sessions 8-9 53
Minimax: Recursive implementation
Complete: Yes, for finite state-spaceOptimal: Yes
Time complexity: O(bm)Space complexity: O(bm) (= DFSDoes not keep all nodes in memory.)
![Page 54: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/54.jpg)
CS 561, Sessions 8-9 54
Do We Have To Do All That Work?
3 812
MAX
MIN
![Page 55: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/55.jpg)
CS 561, Sessions 8-9 55
Do We Have To Do All That Work?
3
3
3 812
MAX
MIN
![Page 56: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/56.jpg)
CS 561, Sessions 8-9 56
Do We Have To Do All That Work?
3
3
2
3 812 2
MAX
MIN
Since 2 is smaller than 3, then there is no need for further search
![Page 57: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/57.jpg)
CS 561, Sessions 8-9 57
Do We Have To Do All That Work?
3
3
X
3 812
MAX
MIN2
14 25
More on this next time: α-β pruning
![Page 58: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/58.jpg)
CS 561, Sessions 8-9 58
1. Move evaluation without complete search
• Complete search is too complex and impractical
• Evaluation function: evaluates value of state using heuristics and cuts off search
• New MINIMAX:• CUTOFF-TEST: cutoff test to replace the termination condition
(e.g., deadline, depth-limit, etc.)• EVAL: evaluation function to replace utility function (e.g.,
number of chess pieces taken)
![Page 59: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/59.jpg)
CS 561, Sessions 8-9 59
Evaluation functions
• Weighted linear evaluation function: to combine n heuristicsf = w1f1 + w2f2 + … + wnfn
E.g, w’s could be the values of pieces (1 for prawn, 3 for bishop etc.)f’s could be the number of type of pieces on the board
![Page 60: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/60.jpg)
CS 561, Sessions 8-9 60
Note: exact values do not matter
![Page 61: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/61.jpg)
CS 561, Sessions 8-9 61
Minimax with cutoff: viable algorithm?
Assume we have 100 seconds, evaluate 104
nodes/s; can evaluate 106
nodes/move
![Page 62: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/62.jpg)
CS 561, Sessions 8-9 62
2. α-β pruning: search cutoff
• Pruning: eliminating a branch of the search tree from consideration without exhaustive examination of each node
• α-β pruning: the basic idea is to prune portions of the search tree that cannot improve the utility value of the max or min node, by just considering the values of nodes seen so far.
• Does it work? Yes, in roughly cuts the branching factor from b to √b resulting in double as far look-ahead than pure minimax
![Page 63: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/63.jpg)
CS 561, Sessions 8-9 63
α-β pruning: example
≥ 6
6
MAX
6 12 8
MIN
![Page 64: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/64.jpg)
CS 561, Sessions 8-9 64
α-β pruning: example
≥ 6
6
MAX
6 12 8 2
≤ 2MIN
![Page 65: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/65.jpg)
CS 561, Sessions 8-9 65
α-β pruning: example
≥ 6
6
MAX
6 12 8 2
≤ 2
5
≤ 5MIN
![Page 66: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/66.jpg)
CS 561, Sessions 8-9 66
α-β pruning: example
≥ 6
6
MAX
6 12 8 2
≤ 2
5
≤ 5MIN
Selected move
![Page 67: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/67.jpg)
CS 561, Sessions 8-9 67
α-β pruning: general principle
Player
Player
Opponent
Opponent
m
n
α
v
If α > v then MAX will chose m so prune tree under n
Similar for β for MIN
![Page 68: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/68.jpg)
CS 561, Sessions 8-9 68
Properties of α-β
![Page 69: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/69.jpg)
CS 561, Sessions 8-9 69
The α-β algorithm:
![Page 70: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/70.jpg)
CS 561, Sessions 8-9 70
More on the α-β algorithm
• Same basic idea as minimax, but prune (cut away) branches of the tree that we know will not contain the solution.
![Page 71: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/71.jpg)
CS 561, Sessions 8-9 71
More on the α-β algorithm: start from Minimax
![Page 72: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/72.jpg)
CS 561, Sessions 8-9 72
Remember: Minimax: Recursive implementation
Complete: Yes, for finite state-spaceOptimal: Yes
Time complexity: O(bm)Space complexity: O(bm) (= DFSDoes not keep all nodes in memory.)
![Page 73: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/73.jpg)
CS 561, Sessions 8-9 73
More on the α-β algorithm
• Same basic idea as minimax, but prune (cut away) branches of the tree that we know will not contain the solution.
• Because minimax is depth-first, let’s consider nodes along a given path in the tree. Then, as we go along this path, we keep track of:• α : Best choice so far for MAX• β : Best choice so far for MIN
![Page 74: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/74.jpg)
CS 561, Sessions 8-9 74
More on the α-β algorithm: start from Minimax
Note: These are bothLocal variables. At theStart of the algorithm,We initialize them toα = -∞ and β = +∞
![Page 75: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/75.jpg)
CS 561, Sessions 8-9 75
More on the α-β algorithm
…
MAX
MIN
MAX
α = -∞β = +∞
5 10 6 2 8 7
Min-Value loopsover these
In Min-Value:
α = -∞β = 5
α = -∞β = 5
α = -∞β = 5
Max-Value loopsover these
![Page 76: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/76.jpg)
CS 561, Sessions 8-9 76
More on the α-β algorithm
…
MAX
MIN
MAX
α = -∞β = +∞
5 10 6 2 8 7
In Max-Value:
α = -∞β = 5
α = -∞β = 5
α = -∞β = 5
α = 5β = +∞Max-Value loops
over these
![Page 77: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/77.jpg)
CS 561, Sessions 8-9 77
In Min-Value:More on the α-β algorithm
…
MAX
MIN
MAX
α = -∞β = +∞
5 10 6 2 8 7α = -∞β = 5
α = -∞β = 5
α = -∞β = 5
α = 5β = +∞
α = 5β = 2 End loop and return 5
Min-Value loopsover these
![Page 78: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/78.jpg)
CS 561, Sessions 8-9 78
In Max-Value:More on the α-β algorithm
…
MAX
MIN
MAX
α = -∞β = +∞
5 10 6 2 8 7α = -∞β = 5
α = -∞β = 5
α = -∞β = 5
α = 5β = +∞
α = 5β = 2 End loop and return 5
α = 5β = +∞
Max-Value loopsover these
![Page 79: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/79.jpg)
CS 561, Sessions 8-9 79
Another way to understand the algorithm
• From: http://yoda.cis.temple.edu:8080/UGAIWWW/lectures95/search/alpha-beta.html
• For a given node N,
α is the value of N to MAXβ is the value of N to MIN
![Page 80: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/80.jpg)
CS 561, Sessions 8-9 80
Example
![Page 81: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/81.jpg)
CS 561, Sessions 8-9 81
α-β algorithm:
![Page 82: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/82.jpg)
CS 561, Sessions 8-9 82
Solution
NODE TYPE ALPHA BETA SCOREA Max -I +IB Min -I +I C Max -I +I D Min -I +I E Max 10 10 10 D Min -I 10 F Max 11 11 11 D Min -I 10 10 C Max 10 +I G Min 10 +I H Max 9 9 9 G Min 10 9 9 C Max 10 +I 10 B Min -I 10 J Max -I 10 K Min -I 10 L Max 14 14 14 K Min -I 10 10 …
NODE TYPE ALPHA BETA SCORE…J Max 10 10 10 B Min -I 10 10 A Max 10 +I Q Min 10 +I R Max 10 +I S Min 10 +I T Max 5 5 5 S Min 10 5 5 R Max 10 +I V Min 10 +I W Max 4 4 4 V Min 10 4 4 R Max 10 +I 10 Q Min 10 10 10 A Max 10 10 10
![Page 83: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/83.jpg)
CS 561, Sessions 8-9 83
State-of-the-art for deterministic games
![Page 84: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/84.jpg)
CS 561, Sessions 8-9 84
Nondeterministic games
![Page 85: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/85.jpg)
CS 561, Sessions 8-9 85
Algorithm for nondeterministic games
![Page 86: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/86.jpg)
CS 561, Sessions 8-9 86
Remember: Minimax algorithm
![Page 87: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/87.jpg)
CS 561, Sessions 8-9 87
Nondeterministic games: the element of chance
3 ?
0.50.5
817
8
?
CHANCE ?
expectimax and expectimin, expected values over all possible outcomes
![Page 88: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/88.jpg)
CS 561, Sessions 8-9 88
Nondeterministic games: the element of chance
3 50.50.5
817
8
5
CHANCE 4 = 0.5*3 + 0.5*5Expectimax
Expectimin
![Page 89: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/89.jpg)
CS 561, Sessions 8-9 89
Evaluation functions: Exact values DO matter
Order-preserving transformation do not necessarily behave the same!
![Page 90: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/90.jpg)
CS 561, Sessions 8-9 90
State-of-the-art for nondeterministic games
![Page 91: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/91.jpg)
CS 561, Sessions 8-9 91
Summary
![Page 92: Assignment 1 due tuesday 9/23/2003 BEFORE midnight Midterm …lsc.fie.umich.mx/~juan/Materias/Posgrado/AI/Ai Tutorial... · 2006. 12. 4. · CS 561, Sessions 8-9 1 Administrativia](https://reader033.fdocuments.us/reader033/viewer/2022053108/6077115ffe4a507b89609d86/html5/thumbnails/92.jpg)
CS 561, Sessions 8-9 92
Exercise: Game Playing
(a) Compute the backed-up values computed by the minimaxalgorithm. Show your answer by writing values at the appropriate nodes in the above tree.
(b) Compute the backed-up values computed by the alpha-beta algorithm. What nodes will not be examined by the alpha-beta pruning algorithm?
(c) What move should Max choose once the values have been backed-up all the way?
A
B C D
E F G H I J K
L M N O P Q R S T U V W YX2 3 8 5 7 6 0 1 5 2 8 4 210
Max
Max
Min
Min
Consider the following game tree in which the evaluation function values are shown below each leaf node. Assume that the root node corresponds to the maximizing player. Assume the search always visits children left-to-right.