运动规划之A*搜索算法-1 介绍 (A* Search)

0、 Planning problem

0.1 Given
  • Map
  • Starting location
  • Goal location
  • Cost
0.2 Goal
  • Find minimum cost path

1、 A* - Artificial Intelligence for Robotics

how a A* search works in a grid?

1.1 heuristic function

h函数表示从任意点(x,y)到目标G的最小估计成本。
heuristic function

g function

h函数表示从起始点S移动到(x,y)的最小估计成本。

f-value

f-value表示从起始点S到目标G的成本,f = g + h;
f的最小值即我们要的最短规划路径。

open list

open list

  • 首先把起始位置点加入到一个称为“open List”的列表,

  • 在寻路的过程中,不断把待测试的点加入open List中,同时,为了效率考虑,通常这个列表是个已经排序的列表

  • open list :

起始点[0,0],其(g,f)值为(0,9)
点[4,1],其(g,f)值为(5,9)点[4,2],其(g,f)值为(6,9)
点[3,2],其(g,f)值为(7,11)点[4,3],其(g,f)值为(7,9)
点[3,3],其(g,f)值为(8,11)点[4,3],其(g,f)值为(8,9)
closed list
  • 计算过程中,将f最小的节点不断的加入close list中
  • close list 即为最短路径

2、 A* Pseudocode

To implement A* search, you will implement the following psuedocode, step by step in a sequence of exercises:

Search( grid, initial_point, goal_point ) :

  1. Initialize an empty list of open nodes. // initialize open list

  2. Initialize a starting node with the following:

    1.  x and y values given by initial_point.
    2.  g = 0, where g is the cost for each move. 
    3.  h given by the heuristic function (a function of the current coordinates and the goal).
    
  3. Add the new node to the list of open nodes. //update open list

  4. while the list of open nodes is nonempty:

     1. Sort the open list by f-value    //f = g + h, 遍历open list ,找到f值最小的node 
     2. Pop the optimal cell (called the current cell). 	//将f最小的node 更新到cell中,即close list
     3. Mark the cell's coordinates in the grid as part of the path.
     4. if the current cell is the goal cell:
      		return the grid.			//返回A*算法找到的最小path
       	else, expand the search to the current node's neighbors. This includes the following steps:
     		- Check each neighbor cell in the grid to ensure that the cell is empty: it hasn't been closed and is not an obstacle.
     		- If the cell is empty, compute the cost (g value) and the heuristic, and add to the list of open nodes.
     		- Mark the cell as closed.
    
  5. If you exit the while loop because the list of open nodes is empty, you have run out of new nodes to explore and haven’t found a path.

reference:A* Pathfinding for Beginners

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值