图搜索基础(Graph Search Basis)
State space graph: a mathematical representation of a search algorithm
• For every search problem, there’s a corresponding state space graph
• Connectivity between nodes in the graph is represented by (directed or undirected) edges
The search always start from start state XS
• Searching the graph produces a search tree
• Back-tracing a node in the search tree gives us a path from the start state to that node
• For many problems we can never actually build the whole tree, too large or inefficient – we only want to reach the goal node asap.
Loop
• Remove a node from the container according to some pre-defined score function
• Visit a node
• Expansion: Obtain all neighbors of the node
• Discover all its neighbors
• Push them (neighbors) into the container
End Loop
2.1.1 BFS
2.1.2 DFS
2.1.3 Heuristic search(启发式搜索)
• BFS and DFS pick the next node off the frontiers based on which was “first in” or “last in”.
(BFS和DFS根据哪个节点是“先到”或“后到”,从边界中挑选下一个节点。)
• Greedy Best First picks the “best” node according to some rule, called a heuristic.
(首先根据一些称为启发式的规则选择“最佳”节点。)
• Definition: A heuristic is a guess of how close you are to the target.
(定义:启发式是对你离目标有多近的猜测。)
• A heuristic guides you in the right direction.(启发式指导你找到正确的方向。)
• A heuristic should be easy to compute.(启发式应该易于计算。)
• Euclidean Distance (黄色)
• Manhattan Distance (绿色)
Both are approximations for the actual shortest path.