[Algorithm] A* Search Algorithm Basic

A* is a best-first search, meaning that it solves problems by searching amoung all possible paths to the solution(goal) for the one that incurs the smallest cost(least distance, shortest time, etc.), and among these paths it first considers the one that appears most quickly to the solution.

At each iteration of its main loop, A* need to determine which of its partial paths to expand one or more longer paths. A* selects the path that minimizes

f(n) = g(n) + h(n)

where n is the last node on the path, g(n) is the cost of the path from the start node to n, and h(n) is heuristic that estimates the cheapest cost of path from n to the goal. The heuristic is problem-specific.

a sample of A* search

A* is admissable and considers fewer nodes than any other admissable search algorithm with the same heuristic. This is because A* use an "optimistic" estimate of the cost of a path through every node that it considers -- optimistic in that the true cost of path through that node to goal will be at least as great as the estimate.

Dijkstra‘s algorithm is a special case of A* where h(x)=0 for all x.

BFS(Breadth-First Search) is a special case of Dijkstra‘s algorithm where all edge weights equal to 1.

What set A* apart from greedy best-first search algorithm is that it take the cost/distance already traveled, g(n), into account.

Reference:

A* search algorithm, wikipedia

Dijkstra‘s algorithm, wikipedia

Breadth-first search, wikipedia

What is difference between BFS and Dijkstra‘s algorithms when looking for shortest path?, stackoverflow

时间: 2024-12-29 04:03:25

[Algorithm] A* Search Algorithm Basic的相关文章

2017 UESTC Training for Search Algorithm & String

2017 UESTC Training for Search Algorithm & String A   next[]数组应用 题意:求一个字符串所有前缀出现的次数和. tags:  dp[i-1] = dp[next[i]] + 1. D   字符串next[]数组 题意:求给出字符串的最短循环节. tags:看了题解,原来next[]数组可以这样搞.. 思考KMP的next数组的定义:next[j] = i 代表 s[1...(i-1)] = s[j - i, j-1]. 并且i~j之间已

TSearch & TFileSearch Version 2.2 -Boyer-Moore-Horspool search algorithm

unit Searches; (*-----------------------------------------------------------------------------* | Components TSearch & TFileSearch | | Version: 2.2 | | Last Update: 10 June 2004 | | Compilers: Delphi 3 - Delphi 7 | | Author: Angus Johnson - angusj-AT

[Algorithms] Binary Search Algorithm using TypeScript

(binary search trees) which form the basis of modern databases and immutable data structures. Binary search works very much the way humans intuitively search for a name in a yellow pages directory (if you have ever seen one) or the dictionary. In thi

笔试算法题(48):简介 - A*搜索算法(A Star Search Algorithm)

A*搜索算法(A Star Search Algorithm) A*算法主要用于在二维平面上寻找两个点之间的最短路径.在从起始点到目标点的过程中有很多个状态空间,DFS和BFS没有任何启发策略所以穷举所有的状 态空间,不适合仅需对局部进行搜索的应用.启发式搜索的关键在于:当前节点在选择下一步节点的时候,可以通过一个启发函数进行选择,选择到达终点代价最小 的节点作为下一步节点.A*的启发函数构造为: f(n)=g(n)+h(n) f(n)是可选的下一个节点的代 价,g(n)表示从start点到n点

2018 UESTC Training for Search Algorithm & String

Link A 题意 给两个字符串S,T,问S的所有前缀在T中出现的次数和 分析 kmp SAM后缀数组 2018 UESTC Training for Search Algorithm & String 原文地址:https://www.cnblogs.com/Deadline/p/9127493.html

Method for finding shortest path to destination in traffic network using Dijkstra algorithm or Floyd-warshall algorithm

A method is presented for finding a shortest path from a starting place to a destination place in a traffic network including one or more turn restrictions, one or more U-turns and one or more P-turns using a Dijkstra algorithm. The method as sets a

STL algorithm算法search,search_n(52)

search原型: std::search equality (1) template <class ForwardIterator1, class ForwardIterator2> ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); predicate (2) template <class

UESTC_Palindromic String 2015 UESTC Training for Search Algorithm &amp; String&lt;Problem M&gt;

M - Palindromic String Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 128000/128000KB (Java/Others) Submit Status 秋实大哥喜欢探索新鲜事物,最近他发明了一种新型回文串,叫K重回文串!今天他想用它来考考小朋友们. 秋实大哥给出了与K重回文串有关的信息 任何字符串都属于0重回文串,包括空字符串. 一个长度为N的字符串S,S是K(k≥1)重回文串,当且仅当S是回文串,且其

UESTC_秋实大哥の恋爱物语 2015 UESTC Training for Search Algorithm &amp; String&lt;Problem K&gt;

K - 秋实大哥の恋爱物语 Time Limit: 5000/2000MS (Java/Others)     Memory Limit: 32000/32000KB (Java/Others) Submit Status 传说有这么一个故事! 在一个月白风清的晚上,秋实大哥约一位他心仪的妹子一起逛校园,浪漫的秋实大哥决定在当晚对妹子表白.“XXXXX...”,秋实大哥温情地说完了准备已久的话.而妹子决定用一种浪漫的方式接受秋实大哥(其实妹子早已对秋实大哥动心,这一刻她早已迫不及待了,但还是决定