Expectiminimax
Variation of the minimax algorithm
- 4 min read
- 3 chapters
Related on Lably
Through Artificial intelligence, Expected value and Utility
In the traditional minimax method, the levels of the tree alternate from max to min until the depth limit of the tree has been reached. In an expectiminimax tree, the "chance" nodes are interleaved with the max and min nodes. Instead of taking the max or min of the utility values of their children, chance nodes take a weighted average, with the weight being the probability that child is reached.
The interleaving depends on the game. Each "turn" of the game is evaluated as a "max" node (representing the AI player's turn), a "min" node (representing a potentially-optimal opponent's turn), or a "chance" node (representing a random effect or player).
For example, consider a game in which each round consists of a single die throw, and then decisions made by first the AI player, and then another intelligent opponent. The order of nodes in this game would alternate between "chance", "max" and then "min".
Pseudocode
The expectiminimax algorithm is a variant of the minimax algorithm and was firstly proposed by Donald Michie in 1966. Its pseudocode is given below.
<b id="mwMg">function</b> expectiminimax(node, depth) <b id="mwMw">if</b> node is a terminal node <b id="mwNA">or</b> depth = 0 <b id="mwNQ">return</b> the heuristic value of node <b id="mwNg">if</b> the adversary is to play at node // Return value of minimum-valued child node <b id="mwNw">let</b> α := +∞ <b id="mwOA">foreach</b> child of node α := min(α, expectiminimax(child, depth-1)) <b id="mwOQ">else if</b> we are to play at node // Return value of maximum-valued child node <b id="mwOg">let</b> α := -∞ <b id="mwOw">foreach</b> child of node α := max(α, expectiminimax(child, depth-1)) <b id="mwPA">else if</b> random event at node // Return weighted average of all child nodes' values <b id="mwPQ">let</b> α := 0 <b id="mwPg">foreach</b> child of node α := α + (Probability[child] × expectiminimax(child, depth-1)) <b id="mwPw">return</b> α
Note that for random nodes, there must be a known probability of reaching each child. (For most games of chance, child nodes will be equally-weighted, which means the return value can simply be the average of all child values.)
Sign in to keep reading
2 more chapters are free with a Lably account.
Expectimax search
Expectimax search is a variant described in Universal Artificial Intelligence: Sequential Decisions Based on Algorithmic Probability (2005) by Tom Everitt and Marcus Hutter.
Alpha-beta pruning
Bruce Ballard was the first to develop a technique, called *-minimax, that enables alpha-beta pruning in expectiminimax trees. The problem with integrating alpha-beta pruning into the expectiminimax algorithm is that the scores of a chance node's children may exceed the alpha or beta bound of its parent, even if the weighted value of each child does not. However, it is possible to bound the scores of a chance node's children, and therefore bound the score of the CHANCE node.
If a standard iterative search is about to score the th child of a chance node with equally likely children, that search has computed scores for child nodes 1 through . Assuming a lowest possible score and a highest possible score for each unsearched child, the bounds of the chance node's score is as follows:
If an alpha and/or beta bound are given in scoring the chance node, these bounds can be used to cut off the search of the th child. The above equations can be rearranged to find a new alpha & beta value that will cut off the search if it would cause the chance node to exceed its own alpha and beta bounds:
The pseudocode for extending expectiminimax with fail-hard alpha-beta pruning in this manner is as follows:
<b id="mwZg">function</b> *-minimax(node, depth, α, β) <b id="mwZw">if</b> node is a terminal node <b id="mwaA">or</b> depth = 0 <b id="mwaQ">return</b> the heuristic value of node <b id="mwag">if</b> node is a max or min node <b id="mwaw">return</b> the minimax value of the node <b id="mwbA">let</b> N = numSuccessors(node) // Compute α, β for children <b id="mwbQ">let</b> A = N * (α - U) + U <b id="mwbg">let</b> B = N * (β - L) + L <b id="mwbw">let</b> sum = 0 <b id="mwcA">foreach</b> child of node // Limit child α, β to a valid range <b id="mwcQ">let</b> AX = max(A, L) <b id="mwcg">let</b> BX = min(B, U) // Search the child with new cutoff values <b id="mwcw">let</b> score = *-minimax(child, depth - 1, AX, BX) // Check for α, β cutoff conditions <b id="mwdA">if</b> score <= A <b id="mwdQ">return</b> α <b id="mwdg">if</b> score >= B <b id="mwdw">return</b> β sum += score // Adjust α, β for the next child A += U - v B += L - v // No cutoff occurred, return score <b id="mweA">return</b> sum / N
This technique is one of a family of variants of algorithms which can bound the search of a CHANCE node and its children based on collecting lower and upper bounds of the children during search. Other techniques which can offer performance benefits include probing each child with a heuristic to establish a min or max before performing a full search on each child, etc.

