Skip to content

Preparing support of turn restrictions (1): Extended GraphStorage - #133

Merged
karussell merged 1 commit into
graphhopper:masterfrom
kschrab:master
Dec 22, 2013
Merged

karussell merged 1 commit into
graphhopper:masterfrom
kschrab:master

Conversation

@kschrab

@kschrab kschrab commented Dec 22, 2013

Copy link
Copy Markdown
Contributor

The last attempt to implement turn restriction support "failed" due to one huge commit no one could work with. However, I would love to see this feature in the master very soon, therefore I decided to use the knowledge I gained and try to redesign the whole thing step by step. So here is the first step: storing turn restrictions.

Turn restrictions need to be stored within the graph. To do so and to keep an eye on further extensions like turn costs, a turn cost table needs be stored next to nodes and edges. However, we need to store pointers from nodes to those table somehow which requires additional fields on the nodes. In my first attempt, I created a new complete Graph which extended the current GraphHopperStorage, which was not a good decision. However, I designed the storage problem of turn cost tables from scratch and therefore I want to introduce a component called ExtendedStorage:

An implementation of such ExtendedStorage will be put into GraphHopperStorage on initialization time and offers the possibility to store additional stuff next to nodes and edges without touching GraphHopperStorage. GraphHopperStorage now has an additional integer field for each node and edge. Both fields are optional and the implementation of ExtendedStorage decides, whether those fields will be created or not and those fields should be used.

For example, TurnCostStorage (extends ExtendedStorage) requires the additional field for nodes and stores a pointer towards the first entry of a turn cost table, which is managed by TurnCostStorage.

Relates to #55 and #2

nodes. By default no additional values will be stored and current graphs
are still valid. Any implementation of ExtendedStorage can be put into
GraphHopperStorage, which take care of any additional storages, which
depends on nodes or edges ( e.g. turn cost tables) by reading/writing
those additional values. An example implementation can be found in
TurnCostStorage.

This will be mandandatory to implement support of turn restrictions
later.
@karussell

Copy link
Copy Markdown
Member

The last attempt to implement turn restriction support "failed" due to one huge commit no one could work with

I really appreciate this move! This makes everything a lot simpler!

store additional stuff next to nodes and edges without touching GraphHopperStorage.

Wow, Really nice!

Is it already possible to show in a test case that a graph traversal is turn restricted for car? I would like to see this restriction integrated in the EdgeExplorer somehow, so this should be (somehow ;)) possible to show this functionality even without an edge-based algorithm. Having the restriction separated from the algorithm would also make the switch e.g. between CAR and FOOT easier - e.g. somehow encoder.getTurnIterator() ?

karussell pushed a commit that referenced this pull request Dec 22, 2013
Preparing support of turn restrictions: Extended GraphStorage
@karussell
karussell merged commit 2007a9c into graphhopper:master Dec 22, 2013
@ghost ghost assigned kschrab Dec 22, 2013
@kschrab

kschrab commented Dec 22, 2013

Copy link
Copy Markdown
Contributor Author

Is it already possible to show in a test case that a graph traversal is turn restricted for car?

Nope, it's not possible yet.

Hmpf, I can't switch off the term "turn costs" in my head, when thinking about the code. :D For me a restriction is the same as infinite turn costs, therefore I never think about restrictions, but about costs. However, integrating the restrictions into the edge explorer would be nice indeed, but that's more like "make it clean and faster". I would like to introduce this feature on edge-based algorithms first, using some kind of TurnCostCalculation in each of those algorithms. When this whole thing is finally merged and can be used by some users as an experimental feature, we can go further and implement such improvements. But of course, you and any other one can try to implement such things already, but I want to concentrate on integrating my current progress.

Nevertheless, I integrated turn cost encoding/decoding, see #134.

For me Christmas time has come, need to get the last gifts and then I won't be available for a few days. I wish you all Merry Christmas and happy routing!

@karussell

Copy link
Copy Markdown
Member

For me a restrictions is the same as infinite turn costs

Indeed, then restriction is only a special case and could be tuned which we should do later on.

I wish you all Merry Christmas and happy routing!

Sure and thanks for the pre-xmas presents here already :) !

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

Successfully merging this pull request may close these issues.

2 participants