routing icon indicating copy to clipboard operation
routing copied to clipboard

Alternative route

Open drspam1991 opened this issue 4 years ago • 9 comments

Hi, is it possible to get alternative route (or routes) path from one src and dst point? (multiple route)

drspam1991 avatar Sep 11 '19 12:09 drspam1991

You can try to use a contraction, I am not yet sure if it's intentional but I see differences in the route when using a Contraction vs not.

What I have done is use 2 separate router db's one with a contraction and one without to compare routes.

routerDb.AddContracted(profile, true);

I am not sure if this is intended by the author or not but it seems to be the case in certain routes.

@xivk , is there any intention that contracted routes are different than non contracted routes?

juliusfriedman avatar Mar 09 '20 14:03 juliusfriedman

This is definitely not intentional, routes are supposed to be identical when the same profile is used.

Alternative routes are not supported by using the same profile, the only thing you can do is define 2 profiles that are slightly different. Those should generate alternative routes from some cases.

xivk avatar Mar 09 '20 15:03 xivk

Thank you for the clarification! I will open a new issue or add to this issue some examples of contracted vs non-contracted routes differing.

juliusfriedman avatar Mar 09 '20 16:03 juliusfriedman

See this zip file: @xivk

trip_62768674-62823414_Trowse-Elstow_short-noncontracted is totally different from trip_62768674-62823414_Trowse-Elstow_short-contracted tripComparison.zip

Although they end up at the same place.

if you need other information to help debug this please let me know as I don't know where to look yet.

juliusfriedman avatar Mar 09 '20 16:03 juliusfriedman

It seems the differences in my case were due to the multi threading issues I was experiencing, after https://github.com/itinero/routing/pull/302 it seems there are less differences.

We are processing the results now and will keep you updated.

juliusfriedman avatar Mar 09 '20 18:03 juliusfriedman

Unfortunately it seems there are LESS differences but not all are gone, there seem to be more differences on Fastest rather than shortest for some reason....

I am going to compile the most different results and post that zip also.

juliusfriedman avatar Mar 09 '20 19:03 juliusfriedman

Unfortunately it seems there are LESS differences but not all are gone, there seem to be more differences on Fastest rather than shortest for some reason....

I am going to compile the most different results and post that zip also.

So it turns out we compared some old files trying to do some things to quickly... it appears that the differences ARE gone after #302 with the lock on the db...

We are double confirmed but will triple confirm now.

juliusfriedman avatar Mar 09 '20 19:03 juliusfriedman

In looking at some debug logs we have it seems that the main reason for this was due to multi threading, what seemed to happen when we had the issue is that the router would not be able to find the same exact point on certain attempts and ended up using a different point within the thresholds given to TryResolve. With the issue fixed it seems that the same point is always used and we no longer see the anomalous routes.

We have about 2k more files to compare and test but will let you know today or tomorrow what the final review reveals.

juliusfriedman avatar Mar 09 '20 19:03 juliusfriedman

Just realized this is the wrong thread to be commenting on since this one is about Alternate routes. Sorry for hijacking.

juliusfriedman avatar Mar 09 '20 20:03 juliusfriedman