Algorithm for faster route calculation between two points in parallel Cartesian layers (3D)

Asked

Viewed 3,275 times

30

I’m working on a solution that involves determining the least effort route between two points in a building. (Imagine students on their first day of university, and they need to know where it is and how to get to a given classroom in a building, or how to get from the current classroom to the next class.)

Basically I have a Cartesian structure where each floor is mapped. I also have indicators of access points (doors, ramps for disabled, stairs) and the points where these points connect (Staircase of the Ground Floor connects with staircase of the 2nd floor in X48 Y4, for example), more or less like the image below:

inserir a descrição da imagem aqui

Where cyan indicates a staircase, and odd-blue elevators, among other markers not displayed.

(For color-blind people, my sincere apologies and some additional information: the staircases are located at the top right of the maps; the elevators, near the center.)

I got my code based on a variant of the Dijkstra algorithm called A-Star (A*), which is basically the shortest path problem with some optimizations. (Curiosity: Several games implement variants of A* to determine the character route on a map.)

inserir a descrição da imagem aqui

A* is perfect for determining routes on the same floor, but I have to take into account the various floors, each with a different layout.

Question

Is there any more appropriate way to solve this problem?

Or, more clearly (thanks bfavaretto),

Given the additional factor of N floors, is there any algorithm that is more indicated than A*?

Disclaimer:
Original isometric image of Dougillustrations.com.

  • 3

    I would even try to help you ... but for a color-blind man this color scheme is not helping

  • 1

    I’d put +2 on that question if I could.

  • 1

    @Otto sorry! I added a paragraph especially for you. =)

  • 1

    @bfavaretto I think a clearer question format would be "Given the additional factor of N floors, is there any algorithm that is more indicated than A*?" Another point is performance (N users calculating their routes at the same time), but I don’t want to saturate the question with other 3984 associated...

  • 2

    Okay, now I get it. I think you need something like an A*, only in 3D. As it is not my specialty, I leave only one link that I found now in Google: http://roy-t.nl/index.php/2011/09/24/another-faster-version-of-a-2d3d-in-c/

  • @bfavaretto I downloaded and I’m taking a look. I searched before posting but it never occurred to me to look for A* and 3D. Mad Googlin' Skillz, bro.

  • Onosendai and @bfavaretto in this case is not 3D, but several 2D planes interconnected at specific points. 3D would be if you were jetpack around the building, and were moving vertically within the floor itself (from the point that is up to the hole in the slab where the staircase passes, for example).

  • In what software were these floor illustrations made?

  • @Tony Good question - I just looked for an image that showed the floors in isometric format, thus facilitating the visualization (Keywords: Isometric Floors). It looks like the original is from an Australian designer - I’ll include the link to his work in the post.

  • 1

    @Otto [2], I am also (slightly green and red). And really when someone is going to do something that involves colors, there are so many normal colors, and the guy puts color that is not standard... Then complicates.

Show 5 more comments

3 answers

11

In a very simple way, connecting the floors by an edge, creating a kind of three-dimensional graph seems to me the most appropriate solution.

The algorithm, however, must be customized according to certain conditions. For example, the handicapped configuration would put an infinite cost on the stairs and other roads without accessibility so that these were never selected.

The issue of avoiding elevators at peak times could be another configuration in charge of the user. Already an option to "ride at maximum X floors" would be a little more laborious, requiring storing an additional state for each route.

And for the thing to work well in practice, it would be ideal to have average waiting time metrics of the lifts at each time.

The general idea is that the weights of each edge, that is, of walking each stretch, would have to be based on a dynamic function that considered the user’s settings and also traffic information of that stretch.

However, depending on the amount of nodes and the system usage load, this can be inefficient. In this case, it would be possible to define sub-optimal routes, for example, by pre-calculating for each floor the shortest distance between a given point and the nearest staircase or elevator, then gathering this information to select a global one.

Anyway, these are some ideas. They do not answer conclusively or mathematically the question (and they are too big for comments), but I hope they can generate new ideas that enhance your current solution.

  • 1

    Excellent points, I’ve already added some to the list of 'things we DEFINITELY need to have'. =)

9

Disclaimer: This is not an answer per se, just a compilation of the answers/possibilities so far. I imagine that the final result will be a combination of the suggestions presented.

A* 3D (@bfavaretto)

A possible implementation of this algorithm would map the contact points between the floors, implemented the 'slabs' as described by @Bacco. The height of each layer can be set to 1, since we will not use jetpacks, thus avoiding the horizontal cost calculation.

inserir a descrição da imagem aqui

In the image, red would indicate elevators and blue, staircases; green, walls (impassable objects) and white navigational space. (I hope this color combination is valid for colorblind!)

D* / D* Lite (@Gypsy)

This is very interesting for allowing composite cost calculations of time. Some possible situations:

  • The point to be reached is on one floor superior. The initial cost of the lift is 10+2 per floor. The cost of stairs is 5 initially, but 10 is added to each floor to be covered (+15, +25, etc.) Going up 1 floor by stairs may be better than waiting for the lift, but it is not the case if you need to climb 10.
  • The point to be reached is on one floor inferior. Cost of lift: 10+2 per floor. Cost of stairs: 5+3 per floor (It is not so tiring to go down a ladder, but it takes time.)

Optimizations (@utluiz)

Several good suggestions here, some not directly related to the question but can help create a much better solution.

  • Information on the presence of some physical disability in registered users is present, and route optimization by eliminating stairs is possible. A similar configuration can be offered to public users via selection in the interface.

  • It is possible to use Opencv to analyze noise on images of the cameras that observe the elevators, entrances and staircases and to trace a histogram per hour. The result could be a cost multiplier.

  • One possibility of optimizing this algorithm is to define zones within each floor that have only one possible exit route, and to maintain a cost cache for common predetermined points (access points, etc.) that would save a little bit of the Workload.

  • 1

    I think that would be better in your own question, because if more answers were to come along, this way would be lost.

  • @Wouldn’t that go against the prerogative of 'not answering in the body of the question'? After all, if there is no 'definitive answer', I will mark this as the final result - a compilation of all the valid points mentioned by the participants.

8


  • Actually D* might be a good option if I consider that elevators have a lower standard 'cost' than stairs, but that can vary depending on the time of day - 'Is it worth waiting for the elevator at lunch time, or is it better to go down two flights of stairs? But this is a later question.

  • 1

    Also. Actually you made me dig up some knowledge of the graph theory classes I took about eight years ago.

  • 1

    I found an implementation D*, I’ll take a look and see how I can apply it. Link - http://idm-lab.org/project-a.html

  • 1

    Update: So far it seems to me that the D* Lite has a better cost, since there is no need to recalculate the cost of the path until we reach one of the access points.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.