[OSRM-talk] Route flapping / osrm-prepare adds randomness?
Florian Lohoff
f at zz.de
Tue Jun 30 13:43:16 UTC 2015
Hi,
On Tue, Jun 30, 2015 at 12:45:42PM +0200, Florian Lohoff wrote:
> Hi,
>
> i am doing QA based on calculating routes. For this i have a defined
> set of points (couple hundret) which i calc routes between. On length
> change i get a notification by email that the route has changed.
>
> Now i see routes which regularly flap between 2 different geometries and
> lengths without the OSM data beeing changed so i started investigating.
>
> The route flap happens irregular when osrm-prepare'ing the same
> germany.osm.pbf over an over. I see route flaps on same OSM data input.
>
> What i typically do (pseudo code) every 30-60 Minutes:
>
> while true; do
> update-germany-file-with-osmupdate
> osrm-extract -p car.lua germany.osm.pbf
> osrm-prepare -p car.lua germany.osrm
> restart-osrm-routed
>
> calculate-routes-and-compare-lengths
> done
Okay - i am brute forcing it now with a smaller planet extract and
find disturbing results.
Thats the script i am running - i do not touch the input file
inbetween.
#!/bin/bash
set -x
trap "kill ${ROUTED}" exit
while true; do
[ ! -d run ] || rm -rf run
mkdir run
ln -s ../input/nordrhein-westfalen-latest.osm.pbf \
run/input.pbf
bin/osrm-extract \
-p car.lua \
run/input.pbf
bin/osrm-prepare \
-p car.lua \
run/input.osrm
bin/osrm-routed \
-p 5444 \
-i 127.0.0.1 \
run/input.osrm &
ROUTED=$!
sleep 2
fname=`date +%Y%m%d%H%M%S`
wget -q -O - \
"http://localhost:5444/viaroute?loc=51.8919434301567,8.4548220634405&loc=51.8950384046146,8.46314334319787&instructions=true&compression=false" \
>output/json.${fname}
perl -MData::Dumper -MJSON -e 'my $g=decode_json(<STDIN>); print Dumper $g->{route_geometry};' \
<output/json.${fname} \
>output/geom.${fname}
sleep 1
kill ${ROUTED}
sleep 2
done
Thats the output files:
-rw-r--r-- 1 flo flo 1210 Jun 30 12:55 json.20150630125542
-rw-r--r-- 1 flo flo 1210 Jun 30 12:59 json.20150630125950
-rw-r--r-- 1 flo flo 2270 Jun 30 13:03 json.20150630130358
-rw-r--r-- 1 flo flo 1368 Jun 30 13:08 json.20150630130805
-rw-r--r-- 1 flo flo 1368 Jun 30 13:12 json.20150630131215
-rw-r--r-- 1 flo flo 1368 Jun 30 13:16 json.20150630131623
-rw-r--r-- 1 flo flo 2270 Jun 30 13:20 json.20150630132033
-rw-r--r-- 1 flo flo 1210 Jun 30 13:24 json.20150630132442
-rw-r--r-- 1 flo flo 1368 Jun 30 13:28 json.20150630132852
-rw-r--r-- 1 flo flo 1368 Jun 30 13:33 json.20150630133301
As one can see from the sizes - they differe HUGEly ...
flo at osm:~/projects/route-flap/output$ for i in json*; do json_pp <$i | grep found_alternative; done
"found_alternative" : false,
"found_alternative" : false,
"found_alternative" : true,
"found_alternative" : false,
"found_alternative" : false,
"found_alternative" : false,
"found_alternative" : true,
"found_alternative" : false,
"found_alternative" : false,
"found_alternative" : false,
Although i use the SAME input file - with the SAME coordinates to query for an route
i get different results.
Its a permutation of route A or route B and with or without alternatives
it seems.
Extracting only the geometry with this perl onelines:
perl -MData::Dumper -MJSON -e 'my $g=decode_json(<STDIN>); print Dumper $g->{route_geometry};'
returns significantly different geometries.
-rw-r--r-- 1 flo flo 1696 Jun 30 12:55 geom.20150630125542
-rw-r--r-- 1 flo flo 1696 Jun 30 12:59 geom.20150630125950
-rw-r--r-- 1 flo flo 1696 Jun 30 13:03 geom.20150630130358
-rw-r--r-- 1 flo flo 2345 Jun 30 13:08 geom.20150630130805
-rw-r--r-- 1 flo flo 2345 Jun 30 13:12 geom.20150630131215
-rw-r--r-- 1 flo flo 2345 Jun 30 13:16 geom.20150630131623
-rw-r--r-- 1 flo flo 1696 Jun 30 13:20 geom.20150630132033
-rw-r--r-- 1 flo flo 1696 Jun 30 13:24 geom.20150630132442
-rw-r--r-- 1 flo flo 2345 Jun 30 13:28 geom.20150630132852
-rw-r--r-- 1 flo flo 2345 Jun 30 13:33 geom.20150630133301
-rw-r--r-- 1 flo flo 1696 Jun 30 13:37 geom.20150630133714
Flo
--
Florian Lohoff f at zz.de
We need to self-defense - GnuPG/PGP enable your email today!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20150630/7e700839/attachment.sig>
More information about the OSRM-talk
mailing list