-
-
Notifications
You must be signed in to change notification settings - Fork 377
Closed
Labels
Description
Problem
When routing with pgr_trspViaEdges from and to the same link, the costs are miscalcuated, resulting in wrongly calculated routes. Only if the distance between the points is below 50% the correct route is calculated.
To Reproduce
SELECT * FROM pgr_trspViaEdges(
'SELECT 123::int4 id, 234::int4 source, 235::int4 target, 1::float8 cost, 1::float8 reverse_cost',
ARRAY[123, 123]::INTEGER[],
ARRAY[0.9, 0.1]::FLOAT[],
true,
true)Result:
seq id1 id2 id3 cost
1 1 -1 123 0.1
2 1 234 123 0.1
3 1 -2 -2 0
As can be seen the cost is calculated as 2 times 0.1 and the route lads through node 234 instead of directly. Properly calculated one of the costs would have to be 0.9, and not 0.1.
Expectation
seq id1 id2 id3 cost
1 1 -1 123 0.8
2 1 -2 -2 0
Testcases that work correctly:
- switching the percentages to 0.1, 0.9
- reducing the distance to below 0.5 (so eg. 0.9 0.4)
Platform/versions
Linux, pgrouting 3.6.1
"PostgreSQL 14.10 (Debian 14.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit"
"POSTGIS=""3.4.2 c19ce56"" [EXTENSION] PGSQL=""140"" GEOS=""3.9.0-CAPI-1.16.2"" PROJ=""7.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj DATABASE_PATH=/usr/share/proj/proj.db"" LIBXML=""2.9.10"" LIBJSON=""0.15"" LIBPROTOBUF=""1.3.3"" WAGYU=""0.5.0 (Internal)"" (core procs from ""3.4.0 0874ea3"" need upgrade)"
"3.6.1"