Artificial intelligence algorithms What? Heuristic algorithm principle

  AI algorithm is a heuristic algorithm important, primarily for selecting the best path between two points, A is also achieved by the realization of the evaluation function
  F = G + H
  G represents from this point to the beginning of the cost of
  H is from this point Manhattan distance to the finish.
  And F is the best paths G and H are selected and the minimum value of the next F (More details will be described later)
  Manhattan distance
  Paste_Image.png
  figure above to bear leaves from Manhattan distance by blue line distance represented, which is not considered an obstacle. If the length of each block of the above figure 1, the Manhattan distance at this time is 9 bear.
  Start (X1, Y1), the end (X2, Y2), H = | X2-X1 | + | Y2-Y1 |
  we may calculate the Manhattan distance by a coordinate point geometry, or the above figure as an example, the lower left corner is (0 , 0) point, bear position is (1,4), the position of the leaf (7,1), then H = | 7-1 | + | 1-4 | = 9.
  Open, close the list
  at the picture above, for example. For example, at the beginning, bear CLOSE position will be added to the list, bears the movable point is added to the OPEN list, eight nodes to bear around F = G + An evaluation operation (e.g., H), then eight nodes selected node F minimum value, and then remove the node from the OPEN list and add it to the list Close. Since then, each node performs this evaluation 8 around node operation, and then sequentially calculated. Therefore, each person might have trouble understanding it. I will be explained in detail below.
  * Example algorithm
  Paste_Image.png
  from start to finish, we use the A-star algorithm finds the best path
  Paste_Image.png
  We will define the length of each square is 1, the cost from the start point position is 1 to 5, the cost from 3 to 1.4 1.41. After a good definition, we look at the chart, and then calculate
  Paste_Image.png
  first step, we will add points around the start point to the "open" list, and then perform the evaluation operation. The results shown above. Here, you'll see a small arrow pointing to the starting point. This arrow points to the parent node, and open a list of G values are based on this calculation, which means I need the total cost of the previous parent node running this point. If the points are not the same, the G values are different. After calculation, we found a spot in the image above. F value is 7.41, which is the smallest value, and we chose to remove this point from the one point OPEN list, then add it to the CLOSE list, but when we drop, we found that about one o'clock, two o'clock, and 3 how to deal with three main points of departure points. First of all, the starting point has been added to CLOSE, and he does not need to do this. This is a list of role CLOSE, we can also operate on him at the 2 and 3. For calculation point, when the price we move from one o'clock to 2 o'clock, he needs is a G value becomes 2.41, H will not change. F = 2.41 + 7 = 9.41. This algorithm is mainly used for intelligent writing , we find that this value is greater than the original F value, we can not change it (the parent node points to 1, and F value to 9.41, because we have been trying to minimize the F value), and the same applies to 3 minutes.
If you have an Internet problem, you can ask me, thank you! If you want to learn artificial intelligence together, welcome message exchange.

Guess you like

Origin www.cnblogs.com/phploser/p/12008449.html