AI基础 L7 Informed Search II

A∗ Search

• The A∗ search is probably the most used type of heuristic search
• It combines the cost to reach a node (g(n)) with the cost to get from the node to the
goal (h(n))
f (n) = g(n) 初始状态到节点 n 的实际成本+ h(n)节点 n 到目标状态的估计成本
• f (n) is the estimated cost of the cheapest solution through n
• Since we are trying to find the cheapest solution, it makes sense to try the node with
the lowest f (n) first
• Under certain conditions of h(n), A∗ search is complete and optimal

• In the case of tree search, A∗ is optimal only if h(n) is an admissible heuristic
— A heuristic is admissible, or “optimistic” if it never overestimates the cost to reach the goal
• Using such a heuristic means that f (n) never overestimates the cost of reaching the goal

• The straight line distance is admissible. Why?

直线路径距离是指从当前节点到目标节点的直线距离。在大多数情况下,直线距离是一个可行的启发式,因为它通常不会高估到达目标所需的成本。

Iterative Deepening A∗ (IDA∗)

• Extends the idea of Depth-First Iterative-Deepening (DFID) Search by including the
heuristic estimate
• Instead of a depth limit, uses an upper bound U on the f -value
— U is a current threshold, such that no node with f > U is expanded
— During search, computes an upper bound U ′ for the next iteration
• Like DFID in terms of overheads and advantages
— Limits memory usage by going “depth-first” in the heuristic
— Overhead dependent on the diversity of f -values
U是一个当前的阈值,表示任何节点的 f 值都不会超过这个值。取代limit

在搜索过程中,IDA*会计算下一个迭代的上界 U’。

IDA*通过“深度优先”在启发式中限制内存使用,并且其开销取决于 f 值的多样性。

• Explores states by increasing weighted-plan-cost estimate g + W ∗ h
• Exactly like A∗, except for the weight parameter

• The weight W ∈ R+
0 is an algorithm parameter:
— For W = 0 how does weighted A* behave?
— For W = 1 how does weighted A* behave?
— For W = 10**100 how does weighted A* behave?
• Properties:
— For W > 1 weighted A∗ is bounded suboptimal

加权计划成本估计是实际成本g和启发式成本h的组合,其中W是加权系数。

  • W = 0:当W等于0时,加权计划成本估计只包含实际成本g,不包含启发式成本h。这相当于只考虑了实际成本,而忽略了启发式信息。
  • W = 1:当W等于1时,加权计划成本估计是实际成本g和启发式成本h的简单加和。这相当于A*搜索,它平衡了实际成本和启发式成本。
  • W = 10100:当W远大于1时,加权计划成本估计主要依赖于启发式成本h,而实际成本g的影响被大大削弱。这可能导致算法偏向于选择那些看起来接近目标但实际上可能不是最优的节点。

Admissible Heuristics

 Tree search with A∗ is optimal only if the heuristic used is admissible
— Assume that there is suboptimal goal node G in the frontier, and let the cost of the optimal solution be C∗. Now, f (G) = g(G) + h(G)
— Since h(G) = 0 (as h is admissible), g(G) > C∗
— Now consider a different node on an optimal solution path. If h does not overestimate, then f (n) = g(n) + h(n) ≤ C∗
— So f (n) ≤ C∗ < f (G) so G will not be expanded, and therefore A∗ must return an optimal solution

A∗ in a Graph

• Optimality of admissible heuristics in a graph search requires either
— Always discarding the more expensive of any two paths to the same node; or
— Ensuring that the optimal path to any repeated state is always the first one followed
• The second property holds if h is consistent (a.k.a monotonic): if for every node n
and successor n′ generated by a, the estimated cost of reaching the goal from n is no
greater than the step cost of getting to n′ plus the estimated cost of reaching the
goal from n′

h(n) ≤ c(n, a, n′) + h(n′)
• If h is consistent, then the values of f along any path are nondecreasing

总是丢弃任何两个到达同一节点的更昂贵的路径

或确保到达任何重复状态的最优路径总是第一条被选择的路径

如果启发式h是连续的(consistent,也称为单调的monotonic),则第二个条件成立。这意味着对于图中的每个节点n和由行动a生成的后继节点n’,从n到达目标的最小成本估计不会大于从n到n’的步骤成本加上从n’到达目标的最小成本估计。h(n) ≤ c(n, a, n′) + h(n′) 那么在任意路径上的f值(f(n) = g(n) + h(n))都是非递减的。这保证了A*搜索算法能够找到全局最优解,因为它总是选择具有最低f值的节点进行扩展。

Contours

• Accurate heuristic functions cause the contour to stretch towards the optimal path
more narrowly
• A∗ search is very good, but the number of nodes within the goal contour search space
is still exponential in the length of the solution (unless the heuristic is very very good)
• There are other search techniques which use much less memory at the cost of
increased computation time.
• For many problems, the optimality requirement must be dropped.
不一定要追求最优  

对于Branching factor 一个给定状态可以到达的平均子状态

= 四个边角 4*2  +  一个中心  4  + 四边中间 4*3  / 9  约为3

对于Average depth 平均深度是指在搜索过程中找到目标状态所需的平均步数。

总状态数为  Branching factor的 Average depth次方

• Heuristics:
— The number of misplaced tiles – hamming distance (h1 = 6)拼图板上位置错误的方块数量。
— The sum of distances of the tiles from their goal positions –manhattan distance (h2 = 14)每个方块到其目标位置的水平加垂直距离之和。

Domination

• h2 is always greater than h1
— It therefore dominates h1 (it is a tighter bound on the actual cost)
— And is more efficient
• How can we invent good heuristics? • Typically, by relaxing the problem.

Manhattan距离(h2 = 14)总是大于Hamming距离(h1 = 6),这意味着Manhattan距离提供了对实际成本的一个更紧的约束。因此,Manhattan距离通常被认为是一个更高效的启发式,因为它更接近于实际的最短路径成本。

为了发明好的启发式,找到一个更容易处理的问题,它与原始问题有某种联系,但更容易分析和估计。这种放松可能涉及简化问题、改变问题的某些方面或者引入新的信息。通过这种方式,我们可以创建一个启发式,它能够提供对原始问题状态空间的有效估计。

How to Relax

在8拼图问题中,启发式函数可以通过以下规则生成:

  1. 规则:一个瓷砖可以从方格A移动到方格B,如果:
    • A与B在水平或垂直方向上相邻;
    • B是空白的。

我们可以通过放松这些条件来生成不同的启发式函数:

  • 移除第二个条件:Manhattan距离(h2)。Manhattan距离考虑了方块的实际移动成本,因为它考虑了瓷砖在水平方向和垂直方向上的移动。

  • 移除两个条件:Hamming距离(h1)。Hamming距离考虑了方块的位置,但不考虑它们的移动成本。

Heuristic ≠Search

Search algorithms are not the same as the heuristics that use them!
• Informed search algorithms use them
• Optimal search algorithms depend on admissible heuristics (A∗)
最佳搜索算法取决于可接受的启发式算法(A∗)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值