Skip to content

Fixes wrong routing occurring when stall on demand is used with virtual via-nodes. - #1581

Merged
karussell merged 10 commits into
masterfrom
issue_1574
Mar 28, 2019
Merged

karussell merged 10 commits into
masterfrom
issue_1574

Conversation

@easbar

@easbar easbar commented Mar 28, 2019 •

Copy link
Copy Markdown
Member

Fixes #1574.

I added a test that creates random routing situations including ones that lead to wrong routing results (sometimes connection not found but also wrong weights). This PR also adds a failing integration test and a specific test with only 10 nodes that shows the problem in detail (also see comments in #1574).

This PR fixes all these tests and also the random test did not fail after running it for more than 15 minutes.

The performance measurements on the Germany map showed that the query performance before and after this fix is the same.

When I was experimenting with the the random test I ran into two more (probably very rare) error situations: #1582, #1583

EdgeIterator iter = edgeExplorer.setBaseNode(entry.adjNode);
while (iter.next()) {
// no need to inspect the edge we are coming from
if (iter.getEdge() == entry.adjNode) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I was hoping this might improve performance, but not really. In the iter.getEdge() == entry.adjNode case adjNode.weight+weighting.calcWeight always exactly equals entry.weight below and in this case we never want to stall.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this was a stupid error, it should be entry.edge instead of entry.adjNode, fixed in ec01e5e

IntsRef flags = edge31.getFlags();
carEncoder.getAverageSpeedEnc().setDecimal(false, flags, 22);
edge31.setFlags(flags);
edge31.set(carEncoder.getAverageSpeedEnc(), 22);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the 'new' & right way to do it, right ? very nice!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :)

if (current >= 0 && current < edges.size()) {
return "virtual edge: " + edges.get(current) + ", all: " + edges.toString();
} else {
return "virtual edge: (invalid)" + ", all: " + edges.toString();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this better throw an IllegalStateException?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I don't think so because current=-1 is the state the iterator is in before calling next() for the first time.

@karussell karussell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@karussell karussell added the bug label Mar 28, 2019
@karussell karussell added this to the 0.13 milestone Mar 28, 2019
@karussell
karussell merged commit d18a80c into master Mar 28, 2019
@karussell
karussell deleted the issue_1574 branch March 28, 2019 11:25
@karussell

Copy link
Copy Markdown
Member

Will cherry-pick for 0.12 too

karussell pushed a commit that referenced this pull request Mar 28, 2019
…al via-nodes. (#1581)

* Adds integration test showing bug.

Signed-off-by: easbar <[email protected]>

* Adds unit test explaining the issue.

Signed-off-by: easbar <[email protected]>

* Adds query point to QueryResult.toString();

Signed-off-by: easbar <[email protected]>

* Puts integration test into separate file and adds random graph bug finding test.

Signed-off-by: easbar <[email protected]>

* Fixes the issue by using epsilon for floating point comparison.

Signed-off-by: easbar <[email protected]>

* Fixes forgotten node 8 in test and query graph test (toString()).

Signed-off-by: easbar <[email protected]>

* Minor renames & comments.

Signed-off-by: easbar <[email protected]>

* Cleans-up setting edge speed.

Signed-off-by: easbar <[email protected]>
@easbar

easbar commented Jun 1, 2019

Copy link
Copy Markdown
Member Author

See also ec01e5e

buma pushed a commit to KomootArchive/graphhopper that referenced this pull request Aug 27, 2019
…al via-nodes. (graphhopper#1581)

* Adds integration test showing bug.

Signed-off-by: easbar <[email protected]>

* Adds unit test explaining the issue.

Signed-off-by: easbar <[email protected]>

* Adds query point to QueryResult.toString();

Signed-off-by: easbar <[email protected]>

* Puts integration test into separate file and adds random graph bug finding test.

Signed-off-by: easbar <[email protected]>

* Fixes the issue by using epsilon for floating point comparison.

Signed-off-by: easbar <[email protected]>

* Fixes forgotten node 8 in test and query graph test (toString()).

Signed-off-by: easbar <[email protected]>

* Minor renames & comments.

Signed-off-by: easbar <[email protected]>

* Cleans-up setting edge speed.

Signed-off-by: easbar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rare bug for stall on demand

2 participants