Fix validation issue introduced by #1653 #1673
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "edge following other edges"-precomputation optimization introduced
in #1653 introduced a regression in the composition composition code.
The problem is due to the fact that the optimization was assuming that
the validation/query planning algorithm would always find optimal paths,
but the algorithm was a bit too aggressive at avoid some edges given
that new optimization is in place.
Let's use the example this patch uses as test to illustrate:
When the algorithm is on
T
inA
and looks forv
, it tries to findwhere keys can lead it. In doing so, it:
k2
to B and checked if it was usable. And it is,provided we first use key
k1
to getk1
from B. It's inefficientbut possiblly (it's arguably dumb, but it's an algorithm, it has no
shame).
k1
to B. Now, it actually ignored that edgebecause it already had a path to B (the one from the previous point).
That's because the validation algorithm doesn't care one bit about
efficiency, and that is not the issue. The issue is that the
algorithm was also marking that edge "excluded" for remainder of
the "current loop".
k2
to C, which is actually edge we want to use. Butunfortunately, to use it, we first need to get
k2
from B usingk1
and as mentioned in the previous point, we had mistankenly excluded
that edge, so that edge was considered a dead end when it shouldn't.
it found in point 1, which got it to B, and checked if it could get
to C from there. That's where the algorithm "used to" make progress
by, at this point, using the
k2
edge from B to C. But theoptimization from Optimise indirect path computations #1653 made use ignore that edge, on account that
we never should have to use it.
Note that the optimization of #1653 is not really to blame: the true
problem is that in point 3 above, we're not able to use the
k2
edgefrom A to C due to an incorrect exclusion. It just happens that
before #1653, the algorithm was able to get back on its feet by using
an inefficient option it shouldn't have had to use.
Long story short, the patch fixes the exclusion issue.