Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Considerable difference between contracted and non-contracted routes #311

Open
tmdorum opened this issue Apr 30, 2020 · 14 comments
Open

Considerable difference between contracted and non-contracted routes #311

tmdorum opened this issue Apr 30, 2020 · 14 comments

Comments

@tmdorum
Copy link

tmdorum commented Apr 30, 2020

I have two routes in Norway, same coordinates and "car.classifications" profile. The first is calculated with a router database with a contracted profile and the second is calculated with a router database without a contracted profile.

Both routes should be identical but they are not, and the route with the contracted profile has some strange choices. The non-contracted route is similar to what Google maps shows, but the contracted route is very different.

I'm using Itinero 1.5. I've also tried the latest pre-release with the same result.

Start position: 68 51 40.86N 18 20 54.30E
End position: 69 23 28.09N 20 16 02.13E

Non-contracted route (correct route):
image

Contracted route (incorrect route):
image

I want to have a contracted route that looks like the non-contracted image. Both routes should also be identical regardless of contracted and non-contracted profiles.

Any help would be much appreciated!

@airbreather
Copy link
Contributor

Possible duplicate of #267?

@tmdorum
Copy link
Author

tmdorum commented May 8, 2020

To be able to use this routing library, routing with contracted profiles must generate the correct route.
Is anyone looking into this issue for a possible fix?

@juliusfriedman
Copy link

juliusfriedman commented May 15, 2020

this requires the newest develop instance of Reminisce, the problem is that locking was not occurring for reading on Index's. after the latest develop is built you can link that to the build I reference below and should not experience this.

See also

#302

Be weary I had some issues with contractions with the Change on MaxDistanceSplitter

So if you have issue contracting see:

#306

@tmdorum
Copy link
Author

tmdorum commented May 18, 2020

I've tried with the latest develop instance of Reminiscence with the same result. I've also tried with the latest develop instance of OsmSharp, Itinero.IO.Osm and Itinero as well, but still the same result.

I've attached two routerdb databases which can be used to reproduce the issue.

Using the "car.classifications" profile, the routerdb "norway-extract.osm.routerdb" and "norway-extract-contracted.osm.routerdb" with the following coordinates will reproduce the issue:

Start latitude: 68.86135
Start longitude: 18.3484173

Stop latitude: 69.3911362
Stop longitude: 20.2672577

RouterDB.zip

@juliusfriedman
Copy link

Can you try on #302 and by linking Reminiscence with it locally?

Let me know if you still have issues and I will take a look

@tmdorum
Copy link
Author

tmdorum commented May 25, 2020

I've tried your branch in #302 and linked develop of Reminiscence, but the result is the same. If you try the router databases attached above you can easily reproduce the issue.

@tmdorum
Copy link
Author

tmdorum commented Jun 4, 2020

When contracting the profile after loading the OSM data without restrictions and using the AugmentedWeightHandler, the route is correctly calculated.

So it seems that contracted profiles with restrictions is the problem here.

@tmdorum
Copy link
Author

tmdorum commented Jun 11, 2020

Is there any progress on this issue?

@juliusfriedman
Copy link

juliusfriedman commented Jul 20, 2020

I d k, @xivk hasn't been around here for some time, he was active in OsmSharp where my PR was merged and the version was increased OsmSharp/core#101.

Is there anyway I can be of assistance? Are you using Turn based routing?

@juliusfriedman
Copy link

P.s.

I think you can also fix this in WeightMatrixAlgorithm:

There's definitely improvement as the Weight class offers more than I am using here.

//295
//Todo hope this is correct but tis seems the GetAugmentedWeightHandler is not really used afaik
            //Allocations may be heavy here
            if (_router.Db.HasContractedFor(_profile.Profile))
            {
                var weightsResult = _router.TryCalculateWeight(_profile, _router.GetAugmentedWeightHandler(_profile), locations);
                var v = weightsResult.Value;
                _weights = new float[v.Length][];
                for (int i = 0, e = v.Length; i < e; ++i)
                {
                    int j = v[i].Length;
                    _weights[i] = new float[j];
                    for (; j >= 0; --j)
                    {
                        _weights[i][j] = v[i][j].Value;
                    }
                }
            }
            else
            {
                var weightsResult = _router.TryCalculateWeight(_profile, _weightHandler, locations, locations,
               nonNullInvalids, nonNullInvalids, _settings);
                _weights = weightsResult.Value;
            }

@xivk
Copy link
Contributor

xivk commented Jul 20, 2020

Hey, sorry all, very busy with my day job. I still follow here but fixing this (and first figuring out what the root cause is) will take me a few days (at least) and I still haven't found the spare time.

@tmdorum
Copy link
Author

tmdorum commented Aug 10, 2020

I'm not sure how to use the "TryCalculateWeight" code above.

I generate a contracted database once and save it, and load it later using deserialization for performance reasons.

Most of the issues occur when contracting the profile after loading the OSM data with restrictions (I guess this is what you call "turn based routing"), but there are a few issues that occur without restrictions as well as shown bellow.

So there are issues as the ones bellow as well as the ones at the top of this issue related to contracted databases.

image
image

I don't think there is a workaround for all of these issues as I have tried for a while now without any luck.

@tmdorum
Copy link
Author

tmdorum commented Sep 21, 2020

Is there any progress on this issue?

@tmdorum
Copy link
Author

tmdorum commented Dec 16, 2020

Is there any feedback or progress for a solution for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants