Please tell me more about A Star Navigator.
If two routes are found from start to goal, how will they be prioritized? For example, which direction is given priority from up, down, left, and right?
Please tell me more about A Star Navigator.
If two routes are found from start to goal, how will they be prioritized? For example, which direction is given priority from up, down, left, and right?
Your question is good, although I'd like to clarify something. The A* algorithm doesn't find multiple shortest paths. Instead, it searches along the grid, building up a path as it goes. It if hits a dead end, the algorithm backtracks until it can make a different choice, and then continues building up its path. When it finds the goal, it uses the path that is currently built up.
But there are cases where two or more paths qualify as shortest. A* will only find one, but I think you could still ask the same question, with a slight difference: which of the shortest paths will it find?
I think the answer is that it's indeterminate. The reason for this is a bit technical, but here it is. As part of implementing the A* algorithm, we put new candidate nodes into a heap, sorted by the node's distance to the goal. A heap is a sorting data structure, but it isn't stable, which means that items with the same score can be in any order. So if two nodes are just as good of a path, there's not a reliable way to predict which one FlexSim's AStar will choose.
You can check out the definition of the heap for yourself, since the AStar module source code is now publicly available:
https://github.com/flexsim/AStar/blob/master/AStarDLL/AStarNavigator.h#L44
In the middle of AStarNavigator::calculatePath(), you can see nodes being checked, to see if they can go on the open set:
https://github.com/flexsim/AStar/blob/master/AStarDLL/AStarNavigator.cpp#L982
Eventually, that method calls AStarNavigator::expandOpenSet(), which puts new entries on that heap:
https://github.com/flexsim/AStar/blob/master/AStarDLL/AStarNavigator.cpp#L1253
As the search progresses, it continually checks the heap for the next best node to search along:
https://github.com/flexsim/AStar/blob/master/AStarDLL/AStarNavigator.cpp#L918
Hello @Ryusuke T,
Please reference our manual which gives details about how A* works. The routes are prioritized by the fastest/shortest distance.
9 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved