6

I am trying to program a pathfinder on the worlds oceans. I have used an A* algorithm on a cell mesh containing land and water cells previously. But I think that a better solution will be to have continents and islands and polygons; calculate a visibility mesh for the space in between (just once); then include origin and destination in the visibility graph; then solve A* on the resulting graph. Looking around, I have found a book called computational geometry that describes an algorithm for computing the visibility graph. However, before trying to implement it in C++ - does that sound like a good idea?

As far as I know, a lot of different algorithms have been proposed for computing visibility graphs, with differing numerical complexity. It also seems to me that this is an active field, not something that's been solved for good. So this seems to me to be a genuine question. If you think otherwise, please let me know why!

Edit: I have now implemented an algorithm that first computes the visibility graph, on a world map comprising of polygons, with about 5,000 vertices. In a second step, A* runs on the visibility graph. There is probably a limit, in terms of running time and memory, to how detailed the map can be. Currently, the visibility graph takes about 10 minutes to compute on my laptop (I believe that the algorithm is quite efficient; but I also believe that my code is not very efficient and could be speeded up significantly). Once the visibility graph is calculated, the A* is very quick. Many thanks again for the answers and comments given!

Dom
  • 90
  • 1
  • 3
  • 11
Laetitia
  • 409
  • 5
  • 8
  • Assuming seas and continents don't change, you can precompute all paths or at least precompute many important paths (best paths between straights). In the earlier case if doesn't matter if your algorithm is efficient, only storage matters. In the latter, you'd need an algorithm that can use these optimizations, something that takes limits imposed by Euclidian distance into account, some form of early pruning. – Dima Tisnek Jan 29 '15 at 12:45

2 Answers2

5

Planning on a graph rather than a cell decomposition is a fantastic way to improve the performance of path and motion planning algorithms. However, many algorithms that deal with computational geometry are fraught with challenges (particularly when you can't afford to make mistakes), and it's often best to rely on reliable computational geometry libraries developed by experts in the field.

Rather than overcomplicating your solution, it's probably worth flagging that much of the research in path planning over the last 15 years has been focused on Probabilistic Motion Planning techniques. The two best known examples of these techniques are Rapidly-exploring Random Trees (RRTs) and Probabilistic Roadmaps (PRMs). These algorithms are easy to implement, there are plenty of examples available, and require little in depth knowledge of geometry to get started.

  • Chapter 5 - Sampling Algorithms from "Planning Algorithms" by LaValle covers most of what you'll need to know to get started with Probabilistic Motion Planning
  • Chapter 6 - Combinatorial Algorithms from the same goes over most of the classic visibility like decompositions, and is prefaced with the warning "Warning: Some methods are impractical. Be careful not to make the wrong assumptions when studying the algorithms of this chapter. A few of them are efficient and easy to implement, but many might be neither"
Andrew Walker
  • 40,984
  • 8
  • 62
  • 84
  • In the meantime, as I couldn't find anything ready to go, I started programming a visibility graph. If anyone is interested, please let me know, happy to post some code (I'm not sure this is of interest but as I couldn't find a solution online...). Many thanks for the reply. I had a brief look at the reference. I'm not sure I want a probabilistic method. Chapter 6 seems to cover what I am trying to do, will have a closer look... – Laetitia Jul 30 '14 at 17:33
0

In order for visibility graph algorithms for path planning to be time and memory efficient, some geometric properties can be exploited to reduce the visibility graph without loosing optimality (= always finding the truly shortest path).

Perhaps the most important of such properties is that only edges with an inner angle > 180 degree have to be considered (apart from the start and end nodes).

This paper explains it quite well: A thesis describing the general procedure and a few tweaks in chapter 4.4

Please note that there is open source software available implementing this.

jannikmi
  • 23
  • 4