<< Ai Getting Started (3) >> (c)

zhaozj2021-02-08  279

Blind search is very low, spending a lot of time and space, if we can find a node for from the row, and choose the most promising node. We call this search "启发 式 搜" or "information search". Performing this search requires information, this information is called inspiration information, which can be divided into three types: 1. It is used to determine which is the most promising node, so as not to blindly search 2. Decide from the order of the row. 3. Decides that the nodes should be discarded from the search tree. Let's talk about the first one, which is to judge which one is the most promising node: an orderly search: Also known as the best priority search (Best-first Search). Ni Nilsson proposed a basic algorithm for an ordered search: the valuation function f is determined: a node's hope, the smaller the f value. The algorithm is as follows: 1. Put the start node s into the OPEN table In calculating F (s), linking the value and the S node 2. If the Open is a holiday, you don't have a solution, exit. 3. Select a node that is the smallest F value in the Open table, if there are multiple nodes to meet the requirements, When there is a target node, select the target node, otherwise it will be selected as I 4. Put the i from the OPEN table, add the closed table. 5. If i is a target, then successfully exit, there is a solution 6. Extended node i, generate all subsequent nodes, for each subsequent node J: a .. calculate f (j). B .. If j is not in the OPEN table and the Closed table, add the OPEN table and generate a pointer to i. In order to ask for a solution path. C .. If j is in the OPEN table or a closed table. The just calculated F (j) value and the previous value are compared. If the new value is small: replacing the old value with a new value, from J point i If it moves it back from the Closed table in the Closed table. 7. Steering 2. There is a good valuation function to make it better! The example of the shortest path is a * algorithm. Let's use 8 Digital Puzzle Take Description: We take the price range: f (n) = d (n) w (n) // d (n) is the depth of N, W (n) is a chess pieces that are wrong. Number. Suppose the start nodes are as follows: Target Nodes: 2 8 3 1 2 3 1 6 4 8 4 7 5 7 6 5 First steps There are three in the case, we choose where f (n) smallest: 2 8 3 1 4 7 6 5 Other sequential push. Finally, I took the result with 6 steps. Let's talk about a * algorithm in the next section

转载请注明原文地址:https://www.9cbs.com/read-1468.html

New Post(0)