Lecture5b_Game_Tree_Pruning_2425(1)

Artificial Intelligence and Intelligent Agents Lecture Notes

Introduction

  • Course: F29AI 2016-2024, UC Berkeley AI

  • Topic: Game Tree Pruning

Lecture Overview

  • Key topics covered in this lecture:

    • Game tree pruning

    • Resource limits

    • Evaluation functions

    • Alpha-beta pruning

    • Interaction with opponents in an environment

Game Tree Structures

  • Minimax Algorithm Recap:

    • Example tree values: 3, 12, 8, 2, 4, 6, 14, 5, 2

    • Result: v(B)=3, suggesting the max player should select the left branch (3).

    • Values for other branches: v(C)=2, v(D)=2, v(A)=3.

Resource Limits in Search

  • Challenges of Limited Search:

    • Inability to search to terminal leaf nodes due to resource constraints.

    • Depth-Limited Search:

      • strategy involves:

        • Searching to a predefined depth.

        • Replacing terminal utilities with evaluation functions for non-terminal positions.

    • Result: Loss of guarantee for optimal play, but deeper searches yield closer approximations to true minimax values.

Evaluation Functions

  • Purpose:

    • Score non-terminal nodes to estimate utility.

  • Ideal Function:

    • Should ideally return the utility of the position.

  • Practical Approach:

    • Typically a weighted linear sum of positional features:

      • Example: f1(s) = (num white queens - num black queens).

Example Evaluation Functions

  • Comparisons:

    • When evaluating two scenarios, consider functions such as:

      • 1 / (Pac-Man's distance to the pellet)

      • Pac-Man's distance to the ghost

      • Combined functions like:

        • Pac-Man's distance to the ghost + 1 / (Pac-Man's distance to the pellet)

        • Pac-Man's distance to the ghost + 1000 / (Pac-Man's distance to the pellet).

Alpha-Beta Pruning

  • General Configuration:

    • Focus on computing MIN-VALUE at node v while iterating over its children.

    • Value estimates track the best possible alternatives for both MAX and MIN players:

      • α (alpha) = best value that MAX can obtain at any choice point

      • β (beta) = best value that MIN can obtain.

    • If the value of v exceeds α, further children of v need not be explored — this signifies pruning.

Alpha-Beta Algorithm Overview

  • Functions:

    • Terminal state check, MAX-VALUE, and MIN-VALUE calculations involve establishing:

      • Minimum or maximum of successor states’ values based on alpha and beta bounds.

  • Pseudocode algorithms defined for value evaluations.

Example Walkthroughs of Alpha-Beta Pruning

  • Multiple examples highlighting the adjustments of α and β as the algorithm iterates through decision nodes in a game tree.

  • The progression demonstrates how branches can be pruned based on current α and β values, effectively optimizing performance.

Properties of Alpha-Beta Pruning

  • Effectiveness:

    • Alpha-beta pruning does not alter the minimax value at the root node.

    • Improved child ordering leads to increased pruning efficiency.

    • With perfect ordering, the time complexity can drop to O(b^d/2) thereby increasing solvable game depth.

    • Highlights metareasoning by optimizing computation strategies for searching game trees.