evenfurther / pathfinding

Pathfinding library for rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A* with limited # iterations

bonsairobo opened this issue · comments

Maybe I have a niche use case, but I think it would be nice to have a version of astar where I can pass in the maximum number of iterations. This is useful for real-time setting where I might want to bail out early and just take the best path I have so far. It should be easy to add such a thing, if you would merge a PR, I will write it.

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.74. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

I'll have to see the proposed function prototype first. I'm not sure what "the best path I have so far" means in this context, since you don't have a path at all during the execution of A* and the first path you encounter from source to target is guaranteed to be the best one.

Basically whatever path has the least heuristic score at the end. So say you were trying to find a path in a grid to an unreachable cell, since the cell was totally surrounded by solid cells. A* should find a path right up until you hit the solid cells that block the target. Whatever path gets you closest to the target should have the least heuristic score.

@samueltardieu I implemented what I want here: https://github.com/amethyst/voxel-mapper/blob/master/src/finite_astar.rs

Let me know if it's something you would merge into pathfinding.

I realized that what I really needed for my use case was Greedy Best First Search. So I'm not planning to use A* anymore.