Repository navigation
Makes all tests pass for LM - #1749
Conversation
|
This still doesn't mean the rounding errors discussed in #1557 are gone. Maybe, maybe not. But they're not what has been failing the randomized tests. |
# Conflicts: # core/src/main/java/com/graphhopper/routing/lm/LMApproximator.java
|
I removed the todonow and replaced CarFlagEncoder with MotorcycleFlagEncoder. Then to remove several log warnings I changed the default maximum weight, but still I get exceptions ala: Is this expected as those errors are not fixed in this PR (e.g. still rounding errors) or is this unexpected? |
Careful please, I would say that's not really a minor thing when the PR is about landmark precision. I still stand by this:
So the answer is apparently 'not'. But perhaps now the change that is discussed in #1557 can be applied? (I wanted to remove only one rounding error source at a time..) And I put the unidirectional LM test back in, because
|
|
Maybe we should remove the warning? A too large "max value" is much worse than a too small one, it will just quietly produce wrong routes. |
|
We should write an |
Isn't the underlying problem here more that the max weight guessing procedure is not good enough? I.e. it relies on some distances instead of the weights? We could try to make this better and e.g. go through the graph "from one end to the other". This could be easily done when selecting the first landmark or first 2 landmarks for example.
I replaced this with the MotorcycleFlagEncoder because it uses
Probably I misunderstood this part. The randomized tests are failing occasionally now. How would applying the fix proposed in #1557 help with them, when you say they are not related to the random test failures? I think it is a good idea to apply the fix and yes, let's do this in a separate PR. |
Are they randomly failing on this branch in this state, without My current hypothesis is that the remaining random failures are due to #1557, and they don't happen with a low We get fewer warnings the wronger we are. It's a "trade-off" between overflows (warning, just a performance hit), and precision errors (no warning, wrong route). So when you said:
The "still" is probably the misunderstanding. Then you get exceptions. |
(EDIT) The problem I'm having is that the higher the "max value", the lower the probability of warnings, but the higher the probability of errors, perhaps even if guessed in a "tight" way. |
|
When I put back So what I meant was that the troubles that we were having back then (it's already a long time ago, I had to read all the issues and PRs in context to re-understand it) with randomly failing tests on master should be fixed with this PR. Those errors, for which I created this PR, were due to a problem with the "delta-rounding", in addition to those I already fixed in #1745. Not due to #1557. And there was an additional problem (#1532) which I could isolate by testing unidirectional LM, and that was due to a problem with LM+QueryGraph.
|
# Conflicts: # core/src/main/java/com/graphhopper/routing/AStarBidirection.java # core/src/main/java/com/graphhopper/routing/AbstractBidirAlgo.java # core/src/main/java/com/graphhopper/routing/lm/LandmarkStorage.java # core/src/test/java/com/graphhopper/routing/weighting/RandomizedRoutingTest.java
Sorry, but this reverts Improvement of landmark weight precision, issue 1080 #1376. I just couldn't get it to work. Like others have pointed out, it may be possible, but the numerics involved are totally not clear to me, and in its current state, it's demonstrably wrong.
I also add a treatment of the virtual edge at the target node in the LM-approximator[1]. This is different to what was there before. Before, the current node got a special treatment, which is not necessary.
I now also test unidirectional LM, which catches (2). In bidirectional LM, apparently the stopping criterion is loose enough so (2) doesn't show up.
EDIT (added):
LMApproximatornow rounds down, so it always underapproximates.It also tells the bidirectional A* algorithm that it needs a certain slack for the stopping criterion. This is necessary in addition to 3, because
LMApproximator's rounding makes it violate the triangle inequality ("consistency"), and this probably can't be fixed locally in the approximator.I shifted the
BalancedWeightApproximator(which also has a new name) by constants so that both sides are '0' at their destinations. (Recommended by one of the papers, mainly for clarity, doesn't change the algorithm's behavior if the stopping criterion (6.) is also adapted.)I changed the stopping criterion in A* so it works with 5. (found the new formulation in one of the papers, and couldn't find the previous one; possibly the previous one was correct for the previous approximator, but I suspect it was slightly wrong).
Supercedes #1747.
[1] Goldberg, A.V., Kaplan, H., Werneck, R.F.: Better Landmarks Within Reach. In: Demetrescu, C. (ed.) WEA 2007. LNCS, vol. 4525, pp. 38–51. Springer, Heidelberg (2007)