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:
parent
9158f69ea0
commit
de1d5f199f
@ -55,8 +55,8 @@ Feature: Alternative route
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | alternative |
|
||||
| b | c | bc,bc | |
|
||||
#| c | b | bc,bc | | # alternative path depends on phantom snapping order
|
||||
| b | c | bc,bc | ab,ae,ef,fd,cd,cd |
|
||||
#| c | b | bc,bc | cd,fd,ef,ae,ab,ab | # alternative path depends on phantom snapping order
|
||||
| 1 | c | ab,bc,bc | ab,ae,ef,fd,cd,cd |
|
||||
#| c | 1 | bc,ab | cd,fd,ef,ae,ab | # alternative path depends on phantom snapping order
|
||||
| 2 | c | bc,bc | |
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user