Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL]Using a function for weightmap to dijkstra_shortest_path
From: Amit Prakash Ambasta (amit.prakash.ambasta_at_[hidden])
Date: 2015-11-27 10:40:44


You're correct. Dijkstra doesn't seem like the solution in this case. Using
r_c_shortest paths instead. Is there a parallel version of
r_c_shortest_paths in boost though? I could not find any implementation in
parallel-bgl

On Wed, Nov 25, 2015 at 5:25 PM alex <alexhighviz_at_[hidden]> wrote:

>
>
> >-----Original Message-----
> >From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf
> Of
> >Amit Prakash Ambasta
> >Sent: 23 November 2015 08:20
> >To: boost-users_at_[hidden]
> >Subject: [Boost-users] [BGL]Using a function for weightmap to
> >dijkstra_shortest_path
> >
> >Hi,
> >
> >
> >I am trying to write use BGL.dijkstra to calculate a shortest path in a
> time
> >dependent network where edge.cost C(u, v) is a function of
> >distance_at_edge.source and a variable wait time dependent on Edge.departure
> >i.e.
> >
>
> Are you confident that you can use Dijkstra Shortest Paths for this? To me
> it seems that would only be possible if you knew that delay times are
> increasing over time, but not when they are fluctuating up and down.
>
> The code might be simpler if you put the dynamic part in the combine
> functor instead of the weight map.
>
> using Time = double;
> using Money = double;
>
> struct Distance
> {
> Time time;
> Money cost;
> };
>
> struct Weight
> {
> Time duration;
> Money cost;
>
> Time delay(cost Time& start) const
> {
> // delay as a function of start time
> }
> };
>
> struct Combine
> {
> Distance operator()(const Distance& start, const Weight& weight) const
> {
> Distance finish;
> finish.time = start.time + weight.delay(start.time) +
> weight.duration;
> finish.cost = start.cost + weight.cost;
> return finish;
> }
> };
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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