Uses correct coefficients for local optimality in CH alternatives

The alpha constant is for the local optimality T-Test threshold.

Before we used epsilon for the T-Test threshold, but the epsilon
constant is meant to be used for the stretch test(s) only.

This changeset fixes the local optimality T-Test and uses the
epsilon constant for the two stretch tests:
- We test the stretch for the total route against epsilon and
- We test the detour against the epsilon now, too

We can discuss if the second stretch test should actually use
epsilon, too, or a adapted value of it - but definitly not alpha.
This commit is contained in:
Daniel J. Hofmann
2017-05-31 13:46:47 +02:00
committed by Michael Krasnyk
parent 9158f69ea0
commit de1d5f199f
2 changed files with 5 additions and 6 deletions
@@ -24,7 +24,7 @@ namespace ch
namespace
{
const double constexpr VIAPATH_ALPHA = 0.10;
const double constexpr VIAPATH_ALPHA = 0.25; // alternative is local optimum on 25% sub-paths
const double constexpr VIAPATH_EPSILON = 0.15; // alternative at most 15% longer
const double constexpr VIAPATH_GAMMA = 0.75; // alternative shares at most 75% with the shortest.
@@ -398,8 +398,7 @@ bool viaNodeCandidatePassesTTest(
{
return false;
}
const EdgeWeight T_threshold =
static_cast<EdgeWeight>(VIAPATH_EPSILON * weight_of_shortest_path);
const EdgeWeight T_threshold = static_cast<EdgeWeight>(VIAPATH_ALPHA * weight_of_shortest_path);
EdgeWeight unpacked_until_weight = 0;
std::stack<SearchSpaceEdge> unpack_stack;
@@ -732,7 +731,7 @@ alternativePathSearch(SearchEngineData<Algorithm> &engine_working_data,
(approximated_sharing <= upper_bound_to_shortest_path_weight * VIAPATH_GAMMA);
const bool stretch_passes =
(approximated_weight - approximated_sharing) <
((1. + VIAPATH_ALPHA) * (upper_bound_to_shortest_path_weight - approximated_sharing));
((1. + VIAPATH_EPSILON) * (upper_bound_to_shortest_path_weight - approximated_sharing));
if (weight_passes && sharing_passes && stretch_passes)
{