Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pgr_bdAstar accumulates heuristic cost in visited node cost #2394

Closed
AlexGacon opened this issue Oct 6, 2022 · 1 comment · Fixed by #2437
Closed

Pgr_bdAstar accumulates heuristic cost in visited node cost #2394

AlexGacon opened this issue Oct 6, 2022 · 1 comment · Fixed by #2437
Labels
Milestone

Comments

@AlexGacon
Copy link
Contributor

Problem
A comparison of the pgr_bdastar algorithm with other astart implementation shows that the heuristic is not correctly used in pgr_bdastar: the current implementation for computing the cost of a visited node is to take the cost of the previous visited node and to add the cost of the edge between the two nodes. This is fine except for the fact that the cost of the previous node contains the heuristic cost, since it is provided by the queues.

The heuristic cost must only be used to decide which node to visit next and only for this: it must not be transmitted from node to node.

If you are ok with this analysis, I can work on a fix.

@AlexGacon
Copy link
Contributor Author

Bug found when comparing the result of the A* algorithm with the bidirectional one:
image (2)

In red the path with the classical A* algorithm, in purple the one provided by the bidirectional one. Both have been computed on a road network projected in Lambert 93; as a consequence a factor is applied to turn the distance provided the heuristic into a time.

The A* path is identical to the one found with the djikstra algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants