shootingstar (#18) - Problems with multiple turn restricition (#206) - Message List

Problems with multiple turn restricition

Hi,

I had problems with multiple turn restrictions, the algorithm always use just one restriction. Someone had the same problem? I tried to change my query, how to put the rules, and nothing.

Again insert my lines of debug and realized, again in the file shooting_star_relax.hpp that he tested the restriction of only curve with the first edge that appeared.

Then I inserted the code above in line 99:

ce = pe;

Obviously I put the braces in for loop:

for(int i=0; i< w_pe[g[e].id].size(); ++i) {

ce = pe;

if( ... ) ...

}

Then, it works!

Any comments? Thanks...

  • Message #750

    Thank you for sharing your idea. As time allows I will try it out.

    For multiple turn restrictions it should actually work to duplicate your network link and set different rules for each of them. The algorithm should then check all existing rules.

    • Message #751

      I think it was not to work perfectly because in line 121 ce (current edge) receive the value of its predecessor p[g[ce].id], for the case of exists one restriction that must pass through another edge (http://pgrouting.postlbs.org/wiki/ShootingStar - Second example). But ce never received again the first value of pe (predecessor edge), then, when run the second step of the first for loop (line 98), the algorithm check if the _predecessor of ce_ exists in rest of the list of predecessor of the edge being relaxed, but the correct is check if _ce_ exists in that rest.

      Today afternoon (at Brazil) I try to post here one example with my input data...

      • Message #752

        Sample data:

        --id | source | target | cost | x1 | y1 | x2 | y2 | to_cost | rule

        INSERT INTO temp_edges VALUES(1, 1, 2,1.0,1.0, 1.0,2.0,2.0,2.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(2, 2, 3,1.0,1.0, 2.0,2.0,3.0,2.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(3, 3, 4,1.0,1.0, 3.0,2.0,4.0,2.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(4, 4, 5,1.0,9999.0,4.0,2.0,5.0,2.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(5, 5, 6,1.0,9999.0,5.0,2.0,5.0,1.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(6, 6, 7,1.0,9999.0,5.0,1.0,4.0,1.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(7, 7, 4,1.0,9999.0,4.0,1.0,4.0,2.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(8, 4, 8,5.0,1.0, 4.0,2.0,4.0,3.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(9, 8, 9,5.0,1.0, 4.0,3.0,3.0,3.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(10, 9, 3,5.0,1.0, 3.0,3.0,3.0,2.0,NULL,NULL);

        INSERT INTO temp_edges VALUES(11, 3,10,1.0,1.0, 3.0,2.0,3.0,1.0,9999,'3');

        INSERT INTO temp_edges VALUES(11, 3,10,1.0,1.0, 3.0,2.0,3.0,1.0,9999,'2');

        INSERT INTO temp_edges VALUES(12,10,11,1.0,1.0, 3.0,1.0,3.0,0.1,NULL,NULL);

        And the query:

        SELECT * FROM shortest_path_shooting_star( 'SELECT * FROM temp_edges ORDER BY id ASC,rule DESC', 1, 12, true, true );

        And the result:

        vertex_id;edge_id;cost

        1;1;1

        2;2;1

        4;11;1

        20;12;1

        ---

        If we reverse the order of rules:

        SELECT * FROM shortest_path_shooting_star( 'SELECT * FROM temp_edges ORDER BY id ASC,rule ASC', 1, 12, true, true );

        the result:

        vertex_id;edge_id;cost

        1;1;1

        2;2;1

        4;10;1

        17;9;1

        15;8;1

        6;3;1

        4;11;1

        20;12;1

        Both say to "turn" where has the restriction...

        ---

        With the change, the result is:

        1;1;1

        2;2;1

        4;3;1

        6;8;5

        15;9;5

        17;10;5

        4;11;1

        20;12;1

        Now without violating turn restriction.

        • Message #1365

          Bbcaponi, Thank you!, I've had the same problem and editing shooting_star_relax.hpp line 98,99 and 125 now multiple turn restrictions are working.

          98      for(int i=0; i< w_pe[g[e].id].size(); ++i){
          99      ce = pe;
                  ...
          125     }