AI - Heuristic search of the game tree

I. Overview

Game concept

Game is a kind of competitive activity with intelligent behavior, such as playing chess, war.

Game type

  • Double perfect information game: two players (such as MAX and MIN) confront each other, take turns walking each party not only know the moves the other has gone through, but also to other future estimated walking.
  • Game of chance: there is the unpredictability of the game, such as the toss and so on.

Game Tree

If the information is complete double game process represented by FIG, get an AND / OR tree, this AND / OR tree is referred to as the game tree. In the game tree, the next node that is referred to as MAX MAX walking node, the next node is called a walking MIN MIN nodes.

Features of the game tree

  1. The initial state of the game is the initial node;
  2. The game tree "or" node and the "to" node is the alternating layer by layer;
  3. The whole game process always stand on the position of a party, such as MAX side. All the winning party can make their own final question is primitive, the corresponding node is solvable node; all the other winning final nodes are unsolvable.

Second, the process of Minimax

(1) algorithm ideas

Minimax process generates a portion of the game currently being investigated with a tree node, leaf nodes and static evaluation performed using the evaluation function f (n).

Find the value of the leaf node

  • Advantageously the MAX node evaluation function which takes a positive value
  • Advantageously the junction of MIN, which evaluation function takes a negative value
  • So that both nodes equal, the valuation function takes a value close to zero.

Evaluation of the non-leaf node:

We must start back up from the leaf nodes. Its back is:

  • For MAX nodes, since the MAX side valuation always choose the maximum walking, therefore, the node value MAX back takes on its maximum should successor node estimates.
  • For MIN node, since MIN side is always selected to minimize the walking estimates, thus pushing down value MIN whichever node should successor node minimum valuation.
  • Such calculations step by step pushed down the value obtained so far backwards until the value of the initial node. This process is called minimax process.

(2) process instance Minimax
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description


Three, α-β pruning

(1) algorithm ideas

Mr. Cheng Minimax process and / or a tree, and then calculate estimates each node, this node generates estimates and calculates separate manner, the need to generate all the nodes within the predetermined depth, the more efficient the search low. If the node can generate edge to edge node estimates, some useless and cut branches, a technique known as α-β pruning.

Pruning

  1. α MAX node (or node) of the current sub-node is the maximum value backwards;
  2. MIN junction (junction point) β is the current child nodes backwards minimum value;
  3. α-β pruning rules are as follows:
  • β pruning: any node n [alpha] value MAX is equal to or greater than the value of its ancestor node β, the following branches n to stop the search, so the node n and push down the value of α. This is called β pruning pruning.
  • α pruning: any node MIN beta] n is a value less than or equal to its ancestor node α, the following branches n to stop the search, so the node n and push down the value of β. This is called α pruning pruning.

(2) α-β pruning example

Here Insert Picture Description

1. Pruning 1:
Here Insert Picture Description
[alpha] pruning: beta] node G value MIN (<= 1) [alpha] is less than or equal to the value of its ancestor node C (> = 4), so that the node G can not ancestors of node C α value increases, the branched G to stop the search, so the node n and push down the value β (<= 1). This is called α pruning pruning.

Explanation: In the drawing, K, L, M valuation introduction to the node F 4 is pushed, i.e., β F is a value of 4, whereby the node C is introduced to push the value of ≥4. To push the lower bound value is denoted C 4, can no longer smaller than 4, so that the value of C [alpha] 4. By the node N inferred valuation push down node G is less than the value of ≦ 1, estimate whether the other child nodes of G just how much push down the value of G can not larger than 1. Thus, a push down the upper bound value G, the value of G ≦ 1. Another known push down the value of C ≥4, the other sub-node G and is impossible to push down the value C increases. Therefore other branches do not have to search for the G, which is equivalent to cut branches.

2. Pruning 2:

Here Insert Picture Description

β pruning: MAX value α of the node D (> = 5) is greater than its predecessors value β (<= 4) of the node A, then D may stop searching the branches, so that the node D can not ancestor node a value of β is decreased, so that the node D and push down the value α (> = 5). This is called β pruning pruning.

Explanation: the F., Push down the value of G may be introduced to push down the value of ≥4 node C, then the value C may be introduced backwards ≤4 node A, i.e. A value of beta] 4. Further, the node P, Q Release node I push down the value 5, the value of ≥5 D thus pushed down, i.e., a value of α D 5. In this case, to push down the value of other child nodes, whether the number D can not push down the value of D and A is reduced or increased, the other branch D is subtracted, and push down the value of A is determined 4.

3. Other pruning (omitted)

Guess you like

Origin blog.csdn.net/starter_____/article/details/91775939