Boost logo

Boost Users :

Subject: Re: [Boost-users] A* heuristic
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-12-23 09:43:48


On Thu, 22 Dec 2011, Maxime van Noppen wrote:

> On 12/21/2011 09:08 PM, Stephen Woodbridge wrote:
>> If this is your case, then one way to handle this in Boost is to create
>> a visitor and check the path length as each node is explored and if it
>> is greater than "t" do not node add any outbound links/nodes to the queue.
>
> Hi,
>
> I'm curious on how this would be done. I've tried to do it some time ago but
> couldn't figure how to use the DijsktraVisitor to achieve it.
>
> http://www.boost.org/doc/libs/1_48_0/libs/graph/doc/DijkstraVisitor.html
>
> So I've defined a "function_property_map" which allows me to have a function
> as weight on my graph and in that cost function I can return
> std::numeric_limits<double>::infinity() when I want to stop the exploration
> on that path.

Instead, you can throw an exception from your visitor whenever a vertex is
visited whose cost is more than your threshold; in Dijksta's algorithm,
vertices are explored in increasing order of cost.

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net