Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the greedy best-first search algorithm different from the best-first search algorithm?

Tags:

Is the greedy best-first search algorithm different from the best-first search algorithm?

The wiki page has a separate paragraph about Greedy BFS but it's a little unclear.

My understanding is that Greedy BFS is just BFS where the "best node from OPEN" in wikipedia's algorithm is a heuristic function one calculates for a node. So implementing this:

OPEN = [initial state] CLOSED = [] while OPEN is not empty do  1. Remove the best node from OPEN, call it n, add it to CLOSED.  2. If n is the goal state, backtrace path to n (through recorded parents) and return path.  3. Create n's successors.  4. For each successor do:    a. If it is not in CLOSED: evaluate it, add it to OPEN, and record its parent.    b. Otherwise: change recorded parent if this new path is better than previous one. done 

with "best node from OPEN" being a heuristic function estimating how close the node is to the goal, is actually Greedy BFS. Am I right?

EDIT: Comment on Anonymouse's answer:

So essentially a greedy BFS doesn't need an "OPEN list" and should base its decisions only on the current node? Is this algorithm GBFS:

1. Set START as CURRENT node 2. Add CURRENT to Path [and optinally, to CLOSED?] 3. If CURRENT is GOAL, exit 4. Evaluate CURRENT's successors 5. Set BEST successor as CURRENT and go to 2. 
like image 284
Alex Avatar asked Dec 04 '11 09:12

Alex


People also ask

What is the difference between greedy best-first search and A * search algorithm?

The only difference between Greedy BFS and A* BFS is in the evaluation function. For Greedy BFS the evaluation function is f(n) = h(n) while for A* the evaluation function is f(n) = g(n) + h(n).

Why greedy best-first search algorithm is not complete?

In summary, greedy BFS is not complete, not optimal, has a time complexity of O(bm) and a space complexity which can be polynomial. A* is complete, optimal, and it has a time and space complexity of O(bm). So, in general, A* uses more memory than greedy BFS. A* becomes impractical when the search space is huge.

What is the other name of the greedy best-first search?

What is the other name of the greedy best first search? Explanation: The greedy best first search algorithm was used to predict the closeness of the end of the path and its solution by some of the computer scientists. It is also known as Pure Heuristic Search.

Is greedy best-first search faster than A *?

No. A* always finds an optimal path, but it does not always do so faster than other algorithms. It's perfectly normal for the greedy search to sometimes do better. Also, your A* heuristic isn't as good as the one you used for the greedy algorithm.


1 Answers

"Best first" could allow revising the decision, whereas, in a greedy algorithm, the decisions should be final, and not revised.

For example, A*-search is a best-first-search, but it is not greedy.

However, note that these terms are not always used with the same definitions. "Greedy" usually means that the decision is never revised, eventually accepting suboptimal solutions at the benefit of improvements in running time. However, I bet you will find situations where "greedy" is used for the combination of "best first + depth first" as in "try to expand the best next step until we hit a dead end, then return to the previous step and continue with the next best there" (which I would call a "prioritized depth first").

Also, it depends on which level of abstraction you are talking about. A* is not greedy in "building a path". It's fine with keeping a large set of open paths around. It is however greedy in "expanding the search space" towards the true shortest path.

like image 190
Has QUIT--Anony-Mousse Avatar answered Sep 16 '22 11:09

Has QUIT--Anony-Mousse