shootingstar (#18) - reverse_cost issue (#344) - Message List

reverse_cost issue

I've come across anomalies using shortest_path_shooting_star. In testing I'm seeing numerous reverse direction routings over one way roads when using osm data for a major city.

In general it appears that reverse_cost is not being considered for the bulk of these cases, and not just the start/end edges.

To confirm this behavior with a smaller data set, I tried the davidgis test/demo data[  http://cartosig.upv.es/es/recursos-sig/pgrouting-shooting-star-usage-example-turn-restriction ]. Here is the sql used and result:

SELECT * FROM shortest_path_shooting_star('SELECT gid as id, source, target, cost, x1, y1, x2, y2, reverse_cost, rule, to_cost FROM wr', 20, 8 , true, true);

vertex_id;edge_id;cost

15;20;48.3246366252935
16;18;38.0005743220152
13;17;39.2224758594282
14;15;39.4286821133412
11;16;29.9822270236865
12;13;38.6094358307609
10;12;25.9044654619518
8;11;60
2;9;40
1;7;53.8753258085636
4;6;12.8311604873812
29;5;10.6864968606796
27;4;14.2572101668807
6;8;62.5380849791951

In the davidgis demo, the correct transition should be from edge 20 to edge 19 (not edge 18 as above), and so on.

My platform is Win XP, Postgres 8.4, Postgis 1.4, pgRouting-1.03_pg-8.4.2, boost 1.42 binaries.

Table 'wr' (gid,source,target,cost,reverse_cost,to_cost,x1,y1,x2,y2,rule)

1;1;2;14.2572101668807;1000;;76.7176891326003;33.775246780918;87.3962905382969;43.2217018705726;""

2;2;3;11.0893168443772;1000;;87.3962905382969;43.2217018705726;87.3962905382969;54.3110187149498;""

3;3;4;13.9884637834871;1000;;87.3962905382969;54.3110187149498;76.7176891326003;63.3467583659239;""

4;4;5;14.2572101668807;1000;;76.7176891326003;63.3467583659239;67.2712340429456;52.6681569602273;""

5;5;6;10.6864968606796;1000;;67.2712340429456;52.6681569602273;66.860518604265;41.9895555545307;""

6;6;1;12.8311604873812;1000;;66.860518604265;41.9895555545307;76.7176891326003;33.775246780918;""

7;7;1;53.8753258085636;53.8753258085636;;80;20;76.7176891326003;33.775246780918;""

8;8;4;62.5380849791951;62.5380849791951;;73.0212501844746;125.775505045381;76.7176891326003;63.3467583659239;""

9;7;9;40;40;;80;-20;120;-20;""

10;9;10;33.4201752293529;33.4201752293529;100;120;-20;141.610728444141;-45.4928328844451;"16"

11;9;11;60;60;;120;-20;180;-20;""

12;11;12;25.9044654619518;25.9044654619518;;180;-20;180.217979680121;-45.9035483231257;""

13;12;10;38.6094358307609;38.6094358307609;;180.217979680121;-45.9035483231257;141.610728444141;-45.4928328844451;""

14;13;12;29.5829181472758;29.5829181472758;100;181.039410557482;-75.4750599081316;180.217979680121;-45.9035483231257;"17"

15;13;14;39.4286821133412;39.4286821133412;;181.039410557482;-75.4750599081316;141.610728444141;-75.4750599081316;""

16;14;10;29.9822270236865;29.9822270236865;;141.610728444141;-75.4750599081316;141.610728444141;-45.4928328844451;""

17;15;13;39.2224758594282;39.2224758594282;;220;-80;181.039410557482;-75.4750599081316;""

18;15;16;38.0005743220152;1000;;220;-80;251.682466010552;-79.1714988562574;""

19;16;15;38.0539027874633;1000;;251.682466010552;-79.1714988562574;220;-80;""

20;17;16;48.3246366252935;48.3246366252935;;300;-80;251.682466010552;-79.1714988562574;""

21;11;18;115.27849852631;115.27849852631;;180;-20;295.218302510699;-23.7249146343713;""

22;18;17;56.4778705670458;56.4778705670458;;295.218302510699;-23.7249146343713;300;-80;""

  • Message #1442

    There is more discussion on this topic between bdrees and me here:

     http://sourceforge.net/tracker/index.php?func=detail&aid=2969685&group_id=300868&atid=1268840

    Could someone please explain what is supposed to be the exact difference between a 'directed' graph and an 'undirected' graph in pgRouting, especially with the shortest path shooting star algorithm?

    How is the reverse cost interpret in case of a directed graph and in case of an undirected graph?

    Why does it seem that the shortest path shooting star is not considering the reverse cost at all, regardless of whether the graph is directed or undirected?

    • Message #1551

      Hi there. It seems definitely that you can have some issues about one way restrictions. I am a newbie testing pgrouting. But I got the Shooting * kind of works on the data from Jean David Techer's website ( http://www.davidgis.fr/documentation/pgrouting-1.02/) with PostgreSQL 8.3 and PGRouting 1.02.However it no longer works when I upgrade to Postgresql 8.4 and pgrouting 1.03.

      Is there some know bugs related to this version and the use of oneway restrictions? I couldn't find any.

      Regards

      • Message #1594

        We are also having similar issues. We're doing the examples on Jean David Teacher's website (see entry above) and the examples work 100% for Djikstra and A*, but the reverse is not working proper for Shooting*. The Shooting* example worked in the forward direction, but the reverse direction ignored the high reverse cost on the traffic circles and followed the exact same edges as the forward example (but just in the reverse order). We also got different answers on the TSP example on the same website.

        Note that we are using PostGreSQL 8.4 and PGRouting 1.03.

        We also had issues installing PGRouting from the unpacked source packages, we could only install from the SVN check-out. Not sure if anyone else has had issues with this as well.

        • Message #1599

          There is a problem with the current source code trunk version: Oneway restriction doesn't work with shooting star algorithm.

          Here is the solution:

          1. You have to download the pgRouting source code 1.03  http://files.postlbs.org/pgrouting/source/pgRouting-1.03.tgz.

          2. In order to compile with Postgres 8.4 and avoid errors like:

          alpha.c:137: error: ‘INT4OID’ undeclared (first use in this function)
          drivedist.c:129: error: ‘INT4OID’ undeclared (first use in this function)
          dijkstra.c:98: error: ‘INT4OID’ undeclared (first use in this function)
          astar.c:140: error: ‘INT4OID’ undeclared (first use in this function)
          shooting_star.c:110: error: ‘INT4OID’ undeclared (first use in this function)
          

          you have to modify this source files:

          pgrouting1.03/extra/driving_distance/src/alpha.c
          pgrouting1.03/extra/driving_distance/src/drivedist.c
          pgrouting1.03/core/src/dijkstra.c
          pgrouting1.03/core/src/astar.c
          pgrouting1.03/core/src/shooting_star.c
          

          adding this code line:

          #include "catalog/pg_type.h"
          

          after this code line:

          #include "funcapi.h"
          

          The problem with the current trunk version is a modification in the source code. This modification was made to try a solution this bug: http://pgrouting.postlbs.org/ticket/190, the bug is not solved in the current trunk version. The modification to the source code introduces this problem with one way restrictions in shooting star algorithm.

          Kind Regards

          • Message #1600

            Thank you for reporting this. I created a ticket: #212

          • Message #1732

            Dear Oscar,
            Im trying to make you solution and I have already installed pgrouting.
            I downloaded version you mentioned and also added code in files you wrote but now I dont know how to configure or make this pgrouting becasue there is no makefile in that archive.
            can you advice me please.