Sign in to follow this  
Markk

Understanding the Jump Point Search algorithm

Recommended Posts

Markk    107
Hi! I'm trying to implement the Jump Point Search algorithm into Java, but having a hard time understanding one part of it.The algorithm is explained in [url="http://users.cecs.anu.edu.au/~dharabor/data/papers/harabor-grastien-aaai11.pdf"]this paper[/url], and I'm using the [url="https://github.com/qiao/PathFinding.js/blob/master/src/finders/JumpPointFinder.js"]source[/url] of [url="http://qiao.github.com/PathFinding.js/visual/"]this JPS implementation[/url] as an example.

When using my example implementation with to find the path around a wall, I get this:
[img]http://i.stack.imgur.com/p1gdl.jpg[/img]

The green and red squares represent the start and end "tiles", gray is wall, blue and lightgreen are jump points (I guess the lightgreens are in the open list, blue in the closed). Now, I get why the tiles at the green arrows came out as jump points, since they all got one forced neighbour, but can someone explain to me why the tiles at the red arrows are jump points?

Thanks!

Share this post


Link to post
Share on other sites
bloodisblue    137
It seems like the algorithm used is this g(y) = g(x) + dist(x; y) so it would always attempt to go diagonally first and than level off because that would shorten the distance to the target earlier in the program. This is why the first thing the algorithm would do is go diagonally until it reaches either the end of the wall or the goal node and than continue going horizontal.

Share this post


Link to post
Share on other sites
pithlit    179
Hi Markk,

Consider what would happen if the blue nodes were not jump points: you would continue to recurse diagonally away from the current node and miss a potential turn of the optimal path. To avoid this problem JPS only recurses diagonally if it determines there are no jump points in a vertical or horizontal direction. If it finds such a node, the recursion stops and the current node returned as a jump point.

Share this post


Link to post
Share on other sites
kruncher    354
Hello Markk

[attachment=12145:jump-node-explained.png]

The above image was derived from images from the whitepaper: [url="http://grastien.net/ban/articles/hg-aaai11.pdf"]http://grastien.net/...s/hg-aaai11.pdf[/url]

Please see lines 8-11 on Algorithm 2 (function jump) for the logic behind this. I hope that this helps you to understand why the successor node is forced in this particular scenario.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this