Chapter 5 Adversarial Search Algorithms
Chapter 5 Adversarial Search Algorithms
Problem-solving in AI
Chapter 5 : Adversarial Search Algorithms
MASTER : SCIENCE DES DONNÉES ET ANALYTIQUE
(SDA)
Jamal BAKKAS
Département Informatique
École Supérieure de Technologie-Safi
1
Search Algorithms: From Single-Agent to Multi-Agent Environments
• Single-agent environments: One agent operating independently within the
environment.
• Focus on finding the optimal solution in static environments.
• Examples: Pathfinding, puzzle solving.
• Multi-agent environments: Multiple agents interacting within the
environment.
• Two main types of interactions:
▪ Cooperative: Agents work together toward a shared goal.
▪ Competitive: Agents have conflicting objectives.
• Challenges in Competitive Scenarios:
• Requires strategic decision-making to outmaneuver opponents.
• The environment becomes dynamic and unpredictable due to agents' actions.
• Adversarial Search Algorithms are designed for competitive multi-agent scenarios,
often modeled as games, to navigate these challenges.
[email protected] Master SDA Chapter 5 : Adversarial Search 2
Adversarial Search Problem
• How it Works:
• Construct a game tree.
• Assign utility values to terminal states.
• Apply the minimax principle to propagate values up the tree.
• The player chooses the move with the highest utility value.
[email protected] Master SDA Chapter 5 : Adversarial Search 8
Minimax Algorithm
• Maximizing Player (Max): Aims to maximize their score or utility
by making moves that improve their chances of success.
Utility(s) if Terminal-test(s)
max a∈Actions(s) minimax(Result(s,a)) if Player(s) = Max
min a∈Actions(s) minimax(Result(s,a)) if Player(s) = Min
Utility
[email protected] Master SDA Chapter 5 : Adversarial Search 12
Minimax Algorithm
– Tic-Tac-Toe
o ≈ 5 legal moves on average, total of 9 moves (9 plies).
o 59 = 1, 953, 125
o 9! = 362, 880 terminal nodes
– Chess
o b ≈ 35 (average branching factor)
o d ≈ 100 (depth of game tree for a typical game)
o bd ≈ 35 100 ≈ 10154 nodes
– Go branching factor starts at 361 (19X19 board)
[email protected] Master SDA Chapter 5 : Adversarial Search 16
Case of limited resources
• Problem: In real games, we are limited in time, so we can’t search
the leaves.
• To be practical and run in a reasonable amount of time and
memory, minimax can only search to some depth.
• More layers make a big difference.
• Solution:
1. Replace terminal utilities with an evaluation function for non-terminal
positions.
2. Use Iterative Deepening Search (IDS).
3. Use pruning: eliminate large parts of the tree.
[email protected] Master SDA Chapter 5 : Adversarial Search 17
α-β pruning algorithm
• Alpha-beta pruning is an optimization technique for the minimax algorithm.
• It reduces the number of game states examined in the minimax search, which grows exponentially with
tree depth.
• The technique uses two threshold parameters, Alpha and Beta, to decide whether a branch of the tree
should be pruned (cut off from further evaluation).
• Pruning allows for skipping some nodes without affecting the correctness of the minimax decision.
• Alpha-beta pruning can prune entire subtrees, not just leaves, making it more efficient than the
standard minimax algorithm.
• The two-parameter can be defined as:
o Alpha: The best (highest-value) choice we have found so far at any point along the path of Maximizer. The initial value
of alpha is -∞.
o Beta: The best (lowest-value) choice we have found so far at any point along the path of Minimizer. The initial value of
beta is +∞.
• Questions:
o Is alpha-beta pruning an alternative to the minimax algorithm?
o Does the alpha-beta pruning algorithm produce different results compared to the
minimax algorithm?