wrap-up first unit motivating logic in ai
DESCRIPTION
Wrap-up First Unit Motivating Logic in AI. Exam #1. My general impression as I graded the exams: You understood the general idea(s) but not the specifics/details You were able to say things that made sense, but you couldn’t identify the key ideas that show that you GET IT. Exam #1. - PowerPoint PPT PresentationTRANSCRIPT
Game Playing
Pruning
• Pruning is used to narrow the search down– e.g. if we find a branch where we will win no
matter what, we don’t need to search that part of the tree anymore
– And if we find a guaranteed losing line we don’t need to search that part of tree any more
MiniMax
• NIM Search tree
1-1-1-1-2
1-1-1-3 1-1-2-2
2-2-21-2-31-1-4
1-5 2-4
6
3-3
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2
1-1-1-3 1-1-2-2
2-2-21-2-31-1-4
1-5 2-4
6(?)
3-3
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2
1-1-1-3 1-1-2-2
2-2-21-2-31-1-4
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2
1-1-1-3 1-1-2-2
2-2-21-2-3(?)1-1-4(?)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2
1-1-1-3(?) 1-1-2-2(?)
2-2-21-2-3(?)1-1-4(?)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(?)
1-1-1-3(?) 1-1-2-2(?)
2-2-21-2-3(?)1-1-4(?)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(?) 1-1-2-2(?)
2-2-21-2-3(?)1-1-4(?)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(-1) 1-1-2-2(?)
2-2-21-2-3(?)1-1-4(?)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(-1) 1-1-2-2(1)
2-2-21-2-3(?)1-1-4(?)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(-1) 1-1-2-2(1)
2-2-21-2-3(?)1-1-4(1)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(-1) 1-1-2-2(1)
2-2-21-2-3(1)1-1-4(1)
1-5(?) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(-1) 1-1-2-2(1)
2-2-21-2-3(1)1-1-4(1)
1-5(1) 2-4(?)
6(?)
3-3(?)
Max moves
Min moves
Max moves
Min moves
MiniMax
• NIM Search tree
1-1-1-1-2(-1)
1-1-1-3(-1) 1-1-2-2(1)
2-2-21-2-3(1)1-1-4(1)
1-5(1) 2-4(?)
6(1)
3-3(?)
Max moves
Min moves
Max moves
Min moves
X X
X
Alpha Beta Pruning
• A generalized pruning procedure– During our depth-first search we remember
• The score of the best choice so far for Max, alpha• And the best score so far for Min, beta
– If we find a point where MIN can choose a move with the utility ≤ alpha. Then we can stop search there since
• MAX will not choose a move since there are a alternative route that is better. (Where alpha was found)
Alpha-Beta (-) Pruning Example
≥ 3
3
3
MAX
MIN
MAX12 8
≤ 2
2 14 5
≤ 14
2
≤5 2
Alpha Beta Pruning
• What can it do for us?– Allows deeper searches without penalty– Allows deeper searches at same time cost
• The result is always the same as without pruning, but a lot faster
Do Exact Values Matter?
MiniMax and Heuristics
• What about more complex games?– If the search space is too large
• We could use a heuristic function to determine which nodes to expand first. (Not very useful though)
• Limit our depth and when we reach a certain depth we evaluate the current standing there
• After evaluating we use MiniMax as usual
MiniMax and heuristics
• Practically, rather than implement MiniMax, we implement MiniCutoff– Don’t build the whole tree. Takes lots of
memory.– Limit the depth of “look ahead”– Use a utility function rather than an evaluation
function.
Cutting Off Search
Cutting Off Search• Issues
– Quiescence• Play has “settled down”• Evaluation function unlikely to exhibit wild swings in value in near
future– Horizon effect
• “Stalling for time”• Postpones inevitable win or damaging move by opponent
• Solutions?– Quiescence search: expand non-quiescent positions further– No general solution to horizon problem at present