0

I have tried pgRouting in PostGres for finding shortest path

select d.*, bs.starttime, bs.endtime, bs.trip_id from pgr_dijkstra(
    'select id, source, target, traveltime as cost from my_table',
    19,
    21,
    directed := true
) d JOIN my_table bs on d.edge = bs.id;

The above doesn't consider time as parameter. Before selecting the next edge, I want to check the time of the transport as well.

Eg:

A ---- > B (03.00PM) (travel time 5)

B ---- > C (3.30PM) (travel time 15)

B ---- > C (11:00AM) (travel time 10)

Current algorithm consider the path with travel time 10 (Without considering the time).

Is there a standard solution for this. I have seen lot of implementations like A* algorithm. I'm talking about half million edges.

Or is there any way to get a hook on previous node or next node while computing pgr algorithms ?

1
  • what's the resolution of your daily travel time values, 30mins.? ...seems rather brutish to have 48 columns (in a closely related second table, maybe) for travel time, but that could be a workaround (pass in time of interest to a wrapper function and base the routing cost on the respective/closest travel time column). any higher resolution would become a pain, though.
    – geozelot
    Oct 25, 2018 at 8:39

1 Answer 1

0

Many years ago a function named TDSP (Time-dependent shortest path) was developed. It's probably what you are looking for, and the source code is still available in the Git repository tagged with gsoc/tdsp-lw: https://github.com/pgRouting/pgrouting/tree/gsoc/tdsp-lw

However, it was very experimental that time and has not been updated since then, so it is not available in current releases and I can't tell if it will still work. Someone had to port it and probably put quite some effort into making it work (again).

2
  • I had a look at it. Doesn't seem compatible with pgRouting 2.x and doesnt seem accurate. Do you have any alternative suggestions ? Oct 25, 2018 at 4:47
  • 2
    No, at the moment I do not know about an alternative. Someone either had to make this work (again) or be able to fund the development.
    – dkastl
    Oct 26, 2018 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.