Intelligence 2E

foundations of computational agents

Dimensions: flat, states, indefinite horizon, fully observable, deterministic, utility, non-learning, multiple agents, offline, perfect rationality

The equivalent to full observability with multiple agents is called perfect information. In perfect-information games, agents act sequentially and, when an agent has to act, it gets to observe the state of the world before deciding what to do. Each agent acts to maximize its own utility.

A perfect-information game can be represented as an extensive form game where the information sets all contain a single node. They can also be represented as a multiagent decision network where the decision nodes are totally ordered and, for each decision node, the parents of that decision node include the preceding decision node and all of their parents (so they are multiagent counterpart of no-forgetting decision networks).

Perfect-information games are solvable in a manner similar to fully observable single-agent systems. The can be solved backward, from the last decisions to the first, using dynamic programming or forward using search. The difference from the single-agent case is that the multiagent algorithm maintains a utility for each agent and, for each move, it selects an action that maximizes the utility of the agent making the move. The dynamic programming variant, called backward induction, starts from the end of the game, computing and caching the values and the plan of each node for each agent. It essentially follows the definition of the utility of a node for each agent, where the agent who controls the node gets to choose the action that maximizes its utility.

Consider the sharing game of Figure 11.2. For each of the nodes labeled with Barb, she gets to choose the value that maximizes her utility. Thus, she will choose “yes” for the right two nodes she controls, and would choose either for the leftmost node she controls. Suppose she chooses “no” for this node; then Andy gets to choose one of his actions: ${k}{\mathit{}}{e}{\mathit{}}{e}{\mathit{}}{p}$ has utility 0 for him, ${s}{\mathit{}}{h}{\mathit{}}{a}{\mathit{}}{r}{\mathit{}}{e}$ has utility 1, and ${g}{\mathit{}}{i}{\mathit{}}{v}{\mathit{}}{e}$ has utility 0, so he chooses to share.

In the case where two agents are competing so that a positive reward for one is a negative reward for the other agent, we have a two-agent zero-sum game. The value of such a game can be characterized by a single number that one agent is trying to maximize and the other agent is trying to minimize. Having a single value for a two-agent zero-sum game leads to a minimax strategy. Each node is either a MAX node, if it is controlled by the agent trying to maximize, or is a MIN node if it is controlled by the agent trying to minimize.

Backward induction could be used to find the optimal minimax strategy. From the bottom up, backward induction maximizes at MAX nodes and minimizes at MIN nodes. However, backward induction requires a traversal of the whole game tree. It is possible to prune part of the search tree by showing that some part of the tree will never be part of an optimal play.

Consider searching in the game tree of Figure 11.5. In this figure, the square MAX nodes are controlled by the maximizing agent, and the round MIN nodes are controlled by the minimizing agent.

Suppose the values of the leaf nodes are given or are computed given the definition of the game. The numbers at the bottom show some of these values. The other values are irrelevant, as we show here. Suppose we are doing a left-first depth-first traversal of this tree. The value of node ${h}$ is 7, because it is the minimum of 7 and 9. Just by considering the leftmost child of ${i}$ with a value of ${\mathrm{6}}$, we know that the value of ${i}$ is less than or equal to 6. Therefore, at node ${d}$, the maximizing agent will go left. We do not have to evaluate the other child of ${i}$. Similarly, the value of ${j}$ is 11, so the value of ${e}$ is at least 11, and so the minimizing agent at node ${b}$ will choose to go left.

The value of ${l}$ is less than or equal to 5, and the value of ${m}$ is less than or equal to 4; thus, the value of ${f}$ is less than or equal to ${\mathrm{5}}$, so the value of ${c}$ will be less than or equal to 5. So, at ${a}$, the maximizing agent will choose to go left. Notice that this argument did not depend on the values of the unnumbered leaves. Moreover, it did not depend on the size of the subtrees that were not explored.

The previous example analyzed what can be pruned. Minimax with alpha-beta ($\alpha $-$\beta $) pruning is a depth-first search algorithm that prunes by passing pruning information down in terms of parameters $\alpha $ and $\beta $. In this depth-first search, a node has a score, which has been obtained from (some of) its descendants.

The parameter $\alpha $ is used to prune MIN nodes. Initially, it is the highest current value for all MAX ancestors of the current node. Any MIN node whose current value is less than or equal to its $\alpha $ value does not have to be explored further. This cutoff was used to prune the other descendants of nodes $l$, $m$, and $c$ in the previous example.

The dual $\beta $ parameter is used to prune MAX nodes.

The minimax algorithm with $\alpha $-$\beta $ pruning is given in Figure 11.6. It is called, initially, with

$$MinimaxAlphaBeta(R,-\mathrm{\infty},\mathrm{\infty}),$$ |

where $R$ is the root node. It returns a pair of the value for the node $n$ and a path of choices that is best for each agent the results in this path. (Note that this path does not include $n$.) Line 13 performs $\beta $ pruning; at this stage the algorithm knows that the current path will never be chosen, and so return a current score. Similarly, line 22 performs $\alpha $-pruning. Line 17 and line 26 concatenate $c$ to the path, as it has found a best path for the agent. In this algorithm, the path “$None$” is sometimes returned for non-leaf nodes; this only occurs when the algorithm has determined this path will not be used.

Consider running ${M}{\mathit{}}{i}{\mathit{}}{n}{\mathit{}}{i}{\mathit{}}{m}{\mathit{}}{a}{\mathit{}}{x}{\mathit{}}{A}{\mathit{}}{l}{\mathit{}}{p}{\mathit{}}{h}{\mathit{}}{a}{\mathit{}}{B}{\mathit{}}{e}{\mathit{}}{t}{\mathit{}}{a}$ on the tree of Figure 11.5. We will show the recursive calls (and the values returned but not the paths.) Initially, it calls

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{a}{,}{-}{\mathrm{\infty}}{,}{\mathrm{\infty}}{)}{,}$$ |

which then calls, in turn,

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{b}{,}{-}{\mathrm{\infty}}{,}{\mathrm{\infty}}{)}$$ |

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{d}{,}{-}{\mathrm{\infty}}{,}{\mathrm{\infty}}{)}$$ |

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{h}{,}{-}{\mathrm{\infty}}{,}{\mathrm{\infty}}{)}{.}$$ |

This last call finds the minimum of both of its children and returns ${\mathrm{7}}$. Next the procedure calls

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{i}{,}{7}{,}{\mathrm{\infty}}{)}{,}$$ |

which then gets the value for the first of ${i}$’s children, which has value ${\mathrm{6}}$. Because ${\alpha}{\mathrm{\ge}}{\beta}$, it returns ${\mathrm{6}}$. The call to ${d}$ then returns ${\mathrm{7}}$, and it calls

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{e}{,}{-}{\mathrm{\infty}}{,}{7}{)}{.}$$ |

Node ${e}$’s first child returns ${\mathrm{11}}$ and, because ${\alpha}{\mathrm{\ge}}{\beta}$, it returns ${\mathrm{11}}$. Then ${b}$ returns ${\mathrm{7}}$, and the call to ${a}$ calls

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{c}{,}{7}{,}{\mathrm{\infty}}{)}{,}$$ |

which in turn calls

$${M}{}{i}{}{n}{}{i}{}{m}{}{a}{}{x}{}{A}{}{l}{}{p}{}{h}{}{a}{}{B}{}{e}{}{t}{}{a}{}{(}{f}{,}{7}{,}{\mathrm{\infty}}{)}{,}$$ |

which eventually returns 5, and so the call to ${c}$ returns 5, and the whole procedure returns 7.

By keeping track of the values, the maximizing agent knows to go left at ${a}$, then the minimizing agent will go left at ${b}$, and so on.

The amount of pruning provided by this algorithm depends on the ordering of the children of each node. It works best if a highest-valued child of a MAX node is selected first and if a lowest-valued child of a MIN node is returned first. In implementations of real games, much of the effort is made to try to ensure this ordering.

Most real games are too big to carry out minimax search, even with $\alpha $-$\beta $ pruning. For these games, instead of only stopping at leaf nodes, it is possible to stop at any node. The value returned at the node where the algorithm stops is an estimate of the value for this node. The function used to estimate the value is an evaluation function. Much work goes into finding good evaluation functions. There is a trade-off between the amount of computation required to compute the evaluation function and the size of the search space that can be explored in any given time. It is an empirical question as to the best compromise between a complex evaluation function and a large search space.