[GraphHopper] Current time calculation in Bidirectional A* and passing it to the custom weighting class

Manikanta Kondeti mani.iiit123 at gmail.com
Wed Jul 29 08:44:52 UTC 2015


Hi Peter,

On Wed, Jul 29, 2015 at 1:40 PM, Peter <graphhopper at gmx.de> wrote:

>  Hi Mani,
>
> I assumed in my first answer you meant just the starting time. But what
> you need is to make the full algorithm time dependent and for that you'll
> need to modify the algorithm itself not just the input parameters like I
> was suggesting. For example you need to introduce a state object instead of
> just the traversalId and the state object also contains the time to make it
> possible that some edges are available only up to a certain time etc.
>
>
 I have an object which takes care of restricted edges with time intervals.
What I am thinking is to tweak the calcWeight method in my custom weighting
and pass a new parameter which a unix timestamp(long variable). So the only
thing left is to calculate time in the algorithm itself.  While talking
about tweaking algorithm, this is what i wanted to do. I will have a
currTime as a member variable and  add currTime only when a new node is
added to the path and pass it to the calcWeight method whenever it checks
for a restriction. That is only two places we need to tweak.



> There are several possibilities, but the short story is that this is not
> easy and really depends on the use case you have (public transport? traffic
> information?) if there are simple alternatives.
>
>
 Usecase is not generic but instead of simple set of blocking edges we have
set of edges that are time dependent. So the idea is to calculate the time
while calculating the path. Will the above specified method works?  Also
why did you mention 'not easy'? Did I miss something important?


> Kind Regards,
> Peter
>
>
Thanks,
Mani


>
> On 29.07.2015 09:40, Manikanta Kondeti wrote:
>
> Hi Peter,
>
>     Thanks for the reply. I want to calculate the time for every node
> added to the path. Lets say we have 5 nodes A B C D E.  I've started from
> A, so my currTime variable is defined and set in Astar.java. So I am
> checking for A - B, while calling calcWeight function in a weighting , I've
> to send my currTime updated. Like currTime = currTime + ( A-B.distance() /
> encoder.getSpeed() );  So now in weighting calcWeight method I can check
> for restriction. The problem is clear for Astar in one way direction. How
> about bi-directional?  What exactly the above parameter does
> (heading_penalty)? We need to calculate time in routing function (
> Astar.java, AstarBi.java, Dijkstra.java etc.) , right?   Let me know if I
> am not clear.
>
>  Thanks,
> Mani
>
>
> _______________________________________________
> GraphHopper mailing listGraphHopper at openstreetmap.orghttps://lists.openstreetmap.org/listinfo/graphhopper
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150729/09ed5f2b/attachment.html>


More information about the GraphHopper mailing list