# [pgrouting-users] TRSP Problem

Christophe Damour sigeal at sigeal.com
Mon Mar 3 11:20:06 PST 2014

```Hi,

Sorry to post twice, I forgot the attached file...

I use pgRouting to calculate accessible routes for disabled pedestrians.
Network edges have some attributes that are used to filter the
accessible network in both ways depending on the user capacities (where
clause).
Network edges have also attributes that are used to update cost /
rev_cost depending on the routing way : If an edge is forbidden in the
digitizing way, cost is set to 1 000 000. If it is forbidden in the
reverse way, rev_cost is set to 1 000 000. If it is forbidden in both
ways, cost and rev_cost are set to  1 000 000.

Now, in some cases, despite there is no accessible route according to
the where clause, pgr_trsp() returns a route going through edges with
cost / rev_cost set to 1 000 000.
If I change the where clause so that there is actually an alternative
route, same edges with cost / rev_cost set to 1 000 000 are taken into
account, and the calculated route is correct.

I attached to this message images of both results (forbidden edges in
red, returned paths in blue).
Routing is calculated from edge n°18295 (vertex n°19314) to edge n°23805
(vertex n°10776).
Wrong edge is n°30606 in test 2.

Here is the sql code of the first test :
SELECT * FROM pgr_trsp(
'SELECT id_tron::integer AS id, source::integer, target::integer,
cost::double precision, rev_cost::double precision AS reverse_cost
FROM rp_test
WHERE type_tron NOT IN(3, 8, 9) AND largeur_c > 90 AND largeur_p > 75
AND etat_revet >= 2',
19314::INTEGER, 10776::INTEGER, true, true,
'SELECT to_cost::double precision, target_id::integer, via_path::text
FROM reseau_global_rest');

And here is the sql code of the second test :
SELECT * FROM pgr_trsp(
'SELECT id_tron::integer AS id, source::integer, target::integer,
cost::double precision, rev_cost::double precision AS reverse_cost
FROM rp_test
WHERE type_tron NOT IN(3, 8, 9) AND largeur_c > 90 AND largeur_p > 75',
19314::INTEGER, 10776::INTEGER, true, true,
'SELECT to_cost::double precision, target_id::integer, via_path::text
FROM reseau_global_rest');

I also attach to this message a shape file of the network.

Do I miss something, or is it a bug ?

Thanks for any help,

--
Christophe DAMOUR

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20140303/510a074b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_trsp.zip
Type: application/x-zip-compressed
Size: 90330 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20140303/510a074b/attachment-0001.bin>
```