[pgrouting-dev] Finally getting back to integrating your TRSP improvements

Stephen Woodbridge woodbri at swoodbridge.com
Sat Apr 12 17:28:29 PDT 2014


Hi Roni,

I hope you and your family are doing well.
I am well but have been very busy. I'm between some contracts at the 
moment and I am looking at the TRSP improvements you did quite a ways 
back to add the reverse cost and routing from nodes A-B-C-...

Looking at multi_dijkstra it seems that I should be able to mimic that 
code based on how you clean up after each route A-B to restart for B-C 
and create a similar function that computes one to many destinations, 
A-B, A-C, A-D, etc.

What do you think?

So for integrating this code, I probably need to implement a family of 
additional functions like:


Existing functions:

pgr_trsp(text, integer, integer, boolean, boolean)
-- node to node

pgr_trsp(text, integer, integer, boolean, boolean, text)
-- node to node with restrictions

pgr_trsp(text, integer, double precision, integer, double precision, 
boolean, boolean)
-- edge to edge

pgr_trsp(text, integer, double precision, integer, double precision, 
boolean, boolean, text)
-- edge to edge with restrictions

pgr_trsp(text, integer[], boolean, boolean, text)
-- array of nodes **this gets changed to use new code (1)**

pgr_trsp(text, integer[], float8[], boolean, boolean, text)
-- array of edges **this gets changed to use new code (2)**

(1) should plug directly into your code. I currently do this in C by 
calling your old code multiple times, but it will be more efficient to 
change this to call multi_dijkstra because we only build the graph once.

(2) I currently do this in C by making multiple calls to your old code. 
The multi_dijkstra only accepts nodes, not edges, so I'll look at making 
a version that can be called by edges. Unless you want to do that :)

Then I think I would like to add a new argument to (1) and (2) above 
"boolean onetomany" and if it is true then we compute A-B, A-C, A-D, ... 
and if it is false it will compute A-B-C-...

I'll have to think about how to return the results, but that should not 
be too hard.

TODO:

1. create function to support multi_dijkstra with edges
2. create new function onetomany_dijkstra for nodes
3. create new function onetomany_dijkstra for edges
4. update C code wrappers to support the above
5. develop test cases
6. write the documentation
7. check it in

Ok that is a bunch of work! Maybe I'll start with just getting (1) done 
so it calls your new code, and write a test case for that. Then tackle 
the rest.

Thoughts?

-Steve


More information about the pgrouting-dev mailing list