0% found this document useful (0 votes)
61 views21 pages

Adversarial Search: Section 1 - 4

1. Adversarial search techniques like minimax and alpha-beta pruning are used to find optimal decisions in two-player games by considering all possible moves by both players. 2. Alpha-beta pruning improves on minimax by avoiding evaluating game states that cannot change the outcome, reducing search time. 3. For real-time games, heuristic evaluation functions are used to estimate position value instead of fully evaluating game trees due to time limits.

Uploaded by

merajul islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views21 pages

Adversarial Search: Section 1 - 4

1. Adversarial search techniques like minimax and alpha-beta pruning are used to find optimal decisions in two-player games by considering all possible moves by both players. 2. Alpha-beta pruning improves on minimax by avoiding evaluating game states that cannot change the outcome, reducing search time. 3. For real-time games, heuristic evaluation functions are used to estimate position value instead of fully evaluating game trees due to time limits.

Uploaded by

merajul islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Adversarial Search

Chapter 6
Section 1 – 4
Outline
• Optimal decisions
• α-β pruning
• Imperfect, real-time decisions
Games vs. search problems
• "Unpredictable" opponent → specifying a
move for every possible opponent reply

• Time limits → unlikely to find goal, must
approximate

Game tree (2-player,
deterministic, turns)
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(bm)

• Space complexity? O(bm) (depth-first exploration)

• For chess, b ≈ 35, m ≈100 for "reasonable" games


→ exact solution completely infeasible

α-β pruning example
α-β pruning example
α-β pruning example
α-β pruning example
α-β pruning example
Properties of α-β
• Pruning does not affect final result

• Good move ordering improves effectiveness of pruning

• With "perfect ordering“, time complexity = O(bm/2)


• With “random ordering”, time complexity = O(b3m/4)

• 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
The α-β algorithm
Resource limits
• Alpha-beta allows us to prune large parts of the search tree.
• However, alpha–beta still has to search all the way to terminal states for at
least a portion of the search space.
• This depth is usually not practical.
• For real-time performance, the search tree needs be further shortened.

Techniques Proposed by Claude Shanon:

• Cutoff Test: e.g., depth limit


• Evaluation Function = estimated desirability of position
The Heuristic MiniMax Algorithm
• The suggestion is to alter minimax or alpha–beta in two ways:

• Replace the utility function by a heuristic evaluation function EVAL,


which estimates the position’s utility.
• Replace the terminal test by a cut-off test that decides when to apply
EVAL

• That gives us the following for heuristic minimax for state s and
maximum depth d:


Characteristics of a Good
Evaluation Function
• Fast !!!!
• For terminal states → should order them
the same way as true utility function.
• For nonterminal states → the evaluation
function should strongly be corelated with
the chance of wining.
Heuristic for Tic Tac Toe

• +100 for EACH 3-in-a-line for computer.


• +10 for EACH two-in-a-line (with a empty cell) for
computer.
• +1 for EACH one-in-a-line (with two empty cells) for
computer.
• Negative scores for opponent, i.e., -100, -10, -1 for
EACH opponent's 3-in-a-line, 2-in-a-line and 1-in-aline.
• 0 otherwise (empty lines or lines with both computer's
and opponent's seeds).
Evaluation function for Chess
• For chess, typically linear weighted sum of features
Eval(s) = w1 f1(s) + w2 f2(s) + … + wn fn(s)

• e.g., w1 = 9 with
f1(s) = (number of white queens) – (number of black
queens), etc.

You might also like