Uninformed Search 无信息搜索
无信息搜索也被称为盲目搜索,该术语(无信息、盲目的)意味着该搜索策略没有超出问题定义提供的状态之外的附加信息。所有能做的就是生成后继节点,并且区分一个目标状态或一个非目标状态。所有的搜索策略是由节点扩展的顺序加以区分。这些搜索策略是:宽度优先、深度优先、以及一致代价搜索。
无信息搜索策略可按照如下特性来评价:
Completeness(完备性):是否总能找到一个存在的解?
Time complexity(时间复杂性):花费多长时间找到这个解?
Space complexity(空间复杂性):需要多少内存?
Optimality(最优性):是否总能找到最优的解?
3. Breadth-first Search (宽度优先搜索)
Search Strategy (搜索策略):扩展最浅的未扩展节点。
Implementation(实现方法):使用FIFO队列,即新的后继节点放在后面。
Breadth-first Search Algoruthm on a Graph (图的宽度优先搜索算法)
function Breadth-First Search(problem) returns a solution, or failure
node ← a node with State = problem.Initial-State , Path-Test = 0
frontier ← a FIFO queue with node as the only element
explored ← an empty set
loop do
if Empty ? (frontier) then return failure
node ← Pop(frontier) //choose the shallowest node in frontier
add node.State to explored
for each action in problem.Action(node.State) do
child ← Child-Node(problem, node, action)
if child.State is not in explored or frontier then
if problem.Goal-Test(child.State) then return Solution(child)
froniter ← Insert(child, froniter)
内存的需求是一个很大的问题,而执行时间仍是一个主要因素。
宽度优先搜索不能解决指数复杂性的问题,小的分支因子除外。
4. Uniform-cost Search (一致代价搜索)
Search Strategy :扩展最低代价的未扩展节点。
Implementation :队列,按路径代价排序,最低优先。
Uniform-cost Search Algorithm
function Uniform-First Search(problem) returns a solution, or failure
node ← a node with State = problem.Initial-State , Path-Test = 0
frontier ← a priority queue ordered by Path-Cost, with node as the only element
explored ← an empty set
loop do
if Empty ? (frontier) then return failure
node ← Pop(frontier) //choose the lowest-cost node in frontier
if problem.Goal-Test(node.State) then return Solution(node)
add node.State to explored
for each action in problem.Action(node.State) do
child ← Child-Node(problem, node, action)
if child.State is not in explored or frontier then
froniter ← Insert(child, froniter)
else if child.State is in frontier with higher Path-Cost then
replace that froniter node with child
5. Depth-first Search (深度优先搜索)
Search Strategy :扩展最深的未扩展节点。
Implementation :使用LIFO队列,把后继节点放在队列的前端。
6. Depth-limited Search (深度受限搜索)
若状态空间无限,深度优先搜索就会发生失败。
这个问题可以用一个预定的深度限制l得到解决,即:深度l以外的节点被视为没有后继节点。
缺点:
如果我们选择l<d,即最浅的目标在深度限制之外,这种方法就会出现额外的不完备性。
如果我们选择l>d,深度受限搜索也将是非最优的。
Depth-limited Search Algorithm
function Depth-Limited-Search(problem, limit) returns a solution, or failure/cutoff
if problem.Goal-Test(node.State) then return Solution(node)
if limit = 0 then return cutoff //no solution
cutoff_occurred? ← false
for each action in problem.Action(node.State) do
child ← Child-Node(problem, node, action)
result ← Recusive-DLS(child, problem, limit - 1)
if result = cutoff then cutoff_occurred ? ← true
else if result ≠ failure then return result
if cutoff_occurred ? then return cutoff //no solution
else return failure
7. Iterative Deepening Search (迭代加深搜索)
它将深度优先和宽度优先的优势相结合,逐步增加深度限制反复运行直到找到目标。
它以深度优先搜索相同的顺序访问搜索树的节点,但先访问节点的累积顺序实际是宽度优先。
function Iterative-Deepening-Search(problem, limit) returns a solution, or failure
for depth = 0 to ∞ do
result ← Depth-Limited-Search(problem, depth)
if result ≠ cutoff then return result
8. Bidirectional Search (双向搜索)
它同时进行两个搜索:一个是从初始状态向前搜索,二另一个则从目标向后搜索。当两者在中间相遇时停止。
该方法可以通过一种剩余距离得启发式估计来导向。
9. Evaluation of Uninformed Tree-search Strategies (无信息树搜索策略评价)
10.General Tree-search Algorithm (一种通用的树搜索算法)
function Tree-Search(problem) returns a solution, or failure
initialize the frontier using the initial state of problem
loop do
if the frontier is empty then return failure
choose a leaf node and remove it from the frontier
if the node contains a goal state then return the corresponding solution
expand the chosen node, adding the resulting nodes to the frontier
该frontier(亦称closed list):一种数据结构,用于存储所有的叶节点。
在frontier上扩展节点的过程持续进行,直到找到一个解、或没有其他状态可扩展。
11.General Graph-search Algorithm (一种通用的图搜索算法)
function Graph-Search(problem) returns a solution, or failure
initialize the frontier using the initial state of problem
initialize the explored to be empty
loop do
if the frontier is empty then return failure
choose a leaf node and remove it from the frontier
if the node contains a goal state then return the corresponding solution
add the node to the explored
expand the chosen node, adding the resutling nodes to the frontier
only if not in the frontier or explored
该explored(亦称closed list):一种数据结构,用于记忆每个扩展节点。
explored或frontier中的节点可以被丢弃。