[GraphHopper] Current time calculation in Bidirectional A* and passing it to the custom weighting class
Peter
graphhopper at gmx.de
Wed Jul 29 09:07:41 UTC 2015
Hi Mani,
yes, you would need to add a long parameter to the calcWeight method as
well as extend one (or all) algorithms to calculate and pass this
parameter to the method. Then grab the timestamp and select the
appropriate weight for an edge in the calcWeight method
> So the only thing left is to calculate time in the algorithm itself.
Yes, you have no other option I think.
> Also why did you mention 'not easy'? Did I miss something important?
If you want to have the fastest solution and make sure you always return
the correct one you need to read more about how public transport routing
works e.g. you can't use CH for the time-dependent model that you have
in mind (and read about this model vs. time-expanded graph). So for your
use case the time-dep model could be lead to sufficient performance, but
it could also be very slow. Also it gets more complex for multi modal
stuff etc.
Kind Regards,
Peter
On 29.07.2015 10:44, Manikanta Kondeti wrote:
>
> Hi Peter,
>
> On Wed, Jul 29, 2015 at 1:40 PM, Peter <graphhopper at gmx.de
> <mailto: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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150729/b542f5c7/attachment.html>
More information about the GraphHopper
mailing list