New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor path pruning for not_thru/destonly/closures #4638
base: master
Are you sure you want to change the base?
Changes from 4 commits
a369698
e9a94a1
8b4d88e
5038dbe
54f9db4
b8b4b18
607d3cd
c5749f6
5865eb9
579482f
997a40f
d990027
6cd0e92
6eba010
9a5be0a
7abd7f3
689707a
b71e92b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,9 +146,9 @@ DynamicCost::DynamicCost(const Costing& costing, | |
const TravelMode mode, | ||
uint32_t access_mask, | ||
bool penalize_uturns) | ||
: pass_(0), allow_transit_connections_(false), allow_destination_only_(true), | ||
allow_conditional_destination_(false), travel_mode_(mode), access_mask_(access_mask), | ||
closure_factor_(kDefaultClosureFactor), flow_mask_(kDefaultFlowMask), | ||
: pass_(0), allow_transit_connections_(false), destination_only_pruning_(true), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renamed the members to be consistent (now it has the opposite meaning of before, so I had to change all logic where this is used or set) |
||
conditional_destination_only_pruning_(true), not_thru_pruning_(true), travel_mode_(mode), | ||
access_mask_(access_mask), closure_factor_(kDefaultClosureFactor), flow_mask_(kDefaultFlowMask), | ||
shortest_(costing.options().shortest()), | ||
ignore_restrictions_(costing.options().ignore_restrictions()), | ||
ignore_non_vehicular_restrictions_(costing.options().ignore_non_vehicular_restrictions()), | ||
|
@@ -239,13 +239,18 @@ void DynamicCost::SetAllowTransitConnections(const bool allow) { | |
} | ||
|
||
// Sets the flag indicating whether destination only edges are allowed. | ||
void DynamicCost::set_allow_destination_only(const bool allow) { | ||
allow_destination_only_ = allow; | ||
void DynamicCost::set_destination_only_pruning(const bool allow) { | ||
destination_only_pruning_ = allow; | ||
} | ||
|
||
// Sets the flag indicating whether edges with valid restriction conditional=destination are allowed. | ||
void DynamicCost::set_allow_conditional_destination(const bool allow) { | ||
allow_conditional_destination_ = allow; | ||
void DynamicCost::set_conditional_destination_only_pruning(const bool allow) { | ||
conditional_destination_only_pruning_ = allow; | ||
} | ||
|
||
// Sets the flag indicating whether we should prune paths leading into not_thru regions. | ||
void DynamicCost::set_not_thru_pruning(const bool allow) { | ||
not_thru_pruning_ = allow; | ||
} | ||
|
||
// Returns the maximum transfer distance between stops that you are willing | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,9 +219,11 @@ void AStarBSSAlgorithm::ExpandForward(GraphReader& graphreader, | |
} | ||
|
||
// Add to the adjacency list and edge labels. | ||
// TODO(nils): no pruning is enabled for this algo for now, needs some investigation if a second | ||
// pass is possible for this algo (bike doesn't allow that) | ||
uint32_t idx = edgelabels_.size(); | ||
edgelabels_.emplace_back(pred_idx, edgeid, GraphId(), directededge, newcost, sortcost, dist, mode, | ||
transition_cost, false, true, false, InternalTurn::kNoTurn, | ||
transition_cost, false, false, false, false, InternalTurn::kNoTurn, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no pruning at all, see comment |
||
baldr::kInvalidRestriction); | ||
*current_es = {EdgeSet::kTemporary, idx}; | ||
adjacencylist_.add(idx); | ||
|
@@ -446,8 +448,8 @@ void AStarBSSAlgorithm::SetOrigin(GraphReader& graphreader, | |
// of the path. | ||
uint32_t d = static_cast<uint32_t>(directededge->length() * (1.0f - edge.percent_along())); | ||
BDEdgeLabel edge_label(kInvalidLabel, edgeid, directededge, cost, sortcost, dist, | ||
travel_mode_t::kPedestrian, baldr::kInvalidRestriction, true, false, | ||
sif::InternalTurn::kNoTurn); | ||
travel_mode_t::kPedestrian, baldr::kInvalidRestriction, false, false, | ||
false, sif::InternalTurn::kNoTurn); | ||
// Set the origin flag and path distance | ||
edge_label.set_origin(); | ||
edge_label.set_path_distance(d); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the
not_thru
check intoAllowed(Reverse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that means it will NOT be put in the adjacency list and that is what's breaking the test below in
gurka_route