ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

A* star A星搜索 reopen/revisit state

2021-08-25 08:32:52  阅读:232  来源: 互联网

标签:heuristic star consistent revisit will state problem nodes


Admissibility + A* with reopen we can derive that we could find the optimal path。

Reopening is what happens when we find a new, better path to a previously expanded node. This is a potentially confusing point because admissibility guarantees for the goal node that this will not happen, but it makes no such guarantee for other nodes.

Have a look at this search problem, where the red numbers are our heuristic.

 

 

 

Note that the heuristic is quite odd, but it is admissible, mostly thanks to the massive 20-cost action required to reach the goal.

Now let's run A* on this problem. Start with Priority Queue (PQ) of {a: 0}.

  • Expand a, adding b (f=3) and d (f=5) to the priority queue. PQ={b: 3, d: 5}

  • Expand b, adding c (f=12). PQ={d: 5, c: 12}

  • Expand d, adding e (f=24). PQ={c: 12, e: 24}

  • Expand c, adding d (f=4). PQ={d: 4, e: 24}

  • ???

We clearly need to expand d next in order to find the optimal solution (a->b->c->d->e (23)). But d was already added to the closed set! This is where slide 32/50 from Chapter 2: Search Algorithms (the slides) comes into play. It allows us to reopen the state d, hence "A* with reopen". If this is not allowed, this node will be discarded and we will instead expand the only remaining node. It contains a goal state, so we return the path a->d->e (24).

This seems like a bit of a problem for A* search, since we can end up with multiple nodes representing the same state. See here how A* has two nodes (n2 and n4) both representing state d.

 

 

 

I haven't thought about how big a problem this is, the possibility that the number of nodes could end up asymptotically dominating the number of states?

Important note: The heuristic in the problem I gave is not consistent - check the transition from state c to state d. I'm not sure whether a consistent heuristic removes the need for reopening, so I'll have a think about that. This answer is already long enough though, so I'll leave it with the code specification for the problem in case anyone else would like to play around with it.

 1 problem = Problem(
 2     "a",
 3     {"a", "b", "c", "d", "e"},
 4     {"e"},
 5     {
 6         "a": {("a", "b"), ("a", "d")},
 7         "b": {("b", "c")},
 8         "c": {("c", "d")},
 9         "d": {("d", "e")},
10         "e": {},
11     },
12     {
13         ("a", ("a", "b")): "b",
14         ("a", ("a", "d")): "d",
15         ("b", ("b", "c")): "c",
16         ("c", ("c", "d")): "d",
17         ("d", ("d", "e")): "e",
18     },
19     {
20         ("a", "b"): 1,
21         ("a", "d"): 4,
22         ("b", "c"): 1,
23         ("c", "d"): 1,
24         ("d", "e"): 20
25     }
26 )
27 heuristic = {
28     "a": 3,
29     "b": 2,
30     "c": 10,
31     "d": 1,
32     "e": 0
33 }

A consistent heuristic, reopening is not needed.

Given that c was expanded before b, and our heuristic is consistent, is it possible that P2 is shorter than P1? I will try to show that it is not.

At expansion-time of c, we must have had f(c) <= f(b). I will use C_P(a,b) to denote the cost of going from a to b via a subset of path P. f(c) = g(c) + h(c) = C_P1(a,c) + h(c), and similarly f(b) = C_P2(a,b) + h(b), giving us the inequality

C_P1(a,c) + h(c) <= C_P2(a,b) + h(b) [1]

Now because h is consistent, we can be sure that h(b) <= h(c) + C_P2(b,c). Substituting into [1], we get

C_P1(a,c) + h(c) <= C_P2(a,b) + h(c) + C_P2(b,c),

therefore C_P1(a,c) <= C_P2(a,b) + C_P2(b,c) = C_P2(a,c) as required; P2 is no shorter than P1.

Proofs related to A* and heuristics: Generalized best-first search strategies and the optimality of A*, Rina Dechter and Judea Pearl, 1985

It is possible that the number of node expansions during the search are greater than the number of states in the transition system. But not always. It depends upon the heuristic function.

So, if we give an admissible and consistent heuristic function to the A* algorithm discussed in the lectures, we will always expand less or equal number of nodes than there are states.

Overall, the worst case the time complexity is exponential in the depth of the solution O(b^d), if b is the branching factor. A good heuristic function is important as it will allow the algorithm to forego expansion of nodes which uninformed search will expand.

There are additional issues related to space complexity for which you may want to look at memory bounded variants including IDA*, MA*.

Vedio: https://youtu.be/_zE5z-KZGRw

标签:heuristic,star,consistent,revisit,will,state,problem,nodes
来源: https://www.cnblogs.com/ray-s/p/15183357.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有