Objectives and Methods

12.3.3 Objectives and Methods

The algorithm is designed with two objectives in mind:

1. to minimize the running time of the search and

2. to perform as many cutoffs as possible, thereby minimizing the cost of the search (total number of operations).

In order to achieve these goals, a distinction is made among the offspring of a node. The

offspring of a node is called the left offspring. The containing the left offspring is called the left

and the process that traverses this is the

left process. All other offspring of a node are called right

and are contained in

that are searched by right processes. This is illustrated in Fig. 12.8, where L and R indicate left and right offspring, respectively. Note that the root is labeled with an L.

right

A high-level description of the algorithm consists of two stages. Stage I : The tree is traversed recursively by

(i) traversing recursively the left of the root and (ii) traversing the left

only of each right offspring of the root. This stage assigns

(i)

a final score to every left offspring and

(ii)

a temporary score to every right offspring (which is the final score of its left offspring).

Stage

2: If the temporary score of a node cannot create a cutoff, then the right of this node are traversed one at a time until they all have been either visited or cut off.

The preceding description is now refined by explaining the mechanism of process creation. We mentioned earlier that a process is associated with every node generated. The tree traversal and process creation proceed as follows. The process associated with a node spawns a left process to traverse the left

of z. This process is associated with the left offspring of

In turn it spawns left and right processes to search all of the left offspring's subtrees. This continues until a final score is assigned to the left offspring of

and backed up, as a temporary score, to z. Concurrently to the traversal of the left

of a temporary value is obtained for each of the right offspring of z. These scores are then compared to the final score of the left offspring and cutoffs are made where appropriate.

The temporary score for a right offspring w is obtained as follows. The process associated with w spawns a process to traverse its left

This new process

12.3 Basic Design Principles

Figure 12.8 Distinction between left and right offspring of node.

Figure 12.9 Process creation during tree traversal.

traverses the backs up a score to w, and terminates. If after a cutoff check the traversal of the right

rooted at w is to continue, then a process is generated to traverse the next

of w. This procedure continues until either the rooted at w is exhaustively traversed or the search is cut off. The foregoing description is illustrated in Fig. 12.9. Here the process associated with the root generates processes

3. Process 1 being a left process generates processes

and

and 1.3 to traverse all of the of the left offspring of the root. Processes 2 and 3 are right processes and therefore generate only processes to search the left

of the right offspring of the root, namely, processes 2.1 and 3.1, respectively. This concludes stage 1. Only if necessary, (one or both) processes 2.2 and

322 Traversing Combinatorial Spaces Chap. 12

2. Note that after generating other processes, a process suspends itself and waits for these to back up a value.

3.2 followed by (one or both) processes 2.3 and 3.3 are created in stage

It is clear that by applying this method those nodes that must be examined by the alpha-beta algorithm will be visited first. This ensures that needless work is not done in stage of the algorithm. Also, a cutoff check is performed before processes are generated in stage 2 to search

that may be cut off.

As mentioned earlier, game trees are typically very large, and it is reasonable to assume that there will be more processes created than there are processors available on the MIMD computer. However, let us assume for the sake of argument that there are more processors than processes. It may be possible in this case to reduce the running time of the tree traversal by generating processes to traverse the

of a right offspring in parallel using the idle processors. This brute-force approach is not used since it conflicts with the other aim of our design, namely, minimizing the cost of the search. The cost of any tree traversal consists mainly in the cost of updating the board in moving from parent to offspring and in the cost of assigning a temporary or

final value to a node. Therefore, even though our algorithm may leave some processors idle in this hypothetical situation, the overall cost in operations is minimized by not traversing

that may not have to be traversed.

We conclude this section by describing how processes are assigned priorities when deciding which is to be executed by an available processor. As already explained, left

Process Priority.

are searched exhaustively by the parallel algorithm, while initially only a single temporary value is obtained from each right

In order to accomplish this, left processes should be given higher priority than right processes. Also, since scores must be obtained from terminal nodes, processes

associated with the deepest nodes in the tree should be given preference. Any formula

Figure 12.10 Assigning priorities to processes.

12.4 The Algorithm 323

for labeling nodes that assigns all offspring a higher priority than their parent and left offspring a higher priority than their right siblings can be used. A process then adopts the priority of the node with which it is associated. One example of such a formula for uniform trees follows. It assigns a priority to a newly generated node as a function of the priority of its parent:

- (f + 1 - i) x

where

f = fan-out of the tree, = depth of the tree, = offspring's position among its siblings in a left-to-right order, 1 i

ply = ply of parent, and a is such that

f The priority of the root is given by

Note that the smaller the integer returned by this formula, the higher the priority. An example of this priority assignment is shown in Fig. 12.10.