Skip to content

Commit

Permalink
some more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsnolde committed Nov 17, 2022
1 parent 4769f10 commit 273d917
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mjolnir/graphenhancer.cc
Expand Up @@ -1668,6 +1668,9 @@ void enhance(const boost::property_tree::ptree& pt,
// Check for not_thru edge (only on low importance edges). Exclude
// transit edges
if (directededge.classification() > RoadClass::kTertiary) {
// (nils): if we want to update all edges in a not_thru region, we'd have to
// go through more tiles than just this one.. we could record the entire set of
// not_thru edges for all tiles and rip through them again after this big loop?
if (IsNotThruEdge(reader, lock, startnode, directededge)) {
directededge.set_not_thru(true);
stats.not_thru++;
Expand Down
8 changes: 8 additions & 0 deletions src/thor/bidirectional_astar.cc
Expand Up @@ -319,6 +319,10 @@ inline bool BidirectionalAStar::ExpandInner(baldr::GraphReader& graphreader,
: astarheuristic_reverse_.Get(t2->get_node_ll(meta.edge->endnode()), dist));

// not_thru_pruning_ is only set to false on the 2nd pass in route_action.
// NOTE(nils): not_thru_pruning() will be false for the correlated (i.e. "first") edges as pred. if
// the current edge is also not_thru we won't prune in the next round. if the current edge is not a
// not_thru we will start pruning next round. that ensures that we can start on a not_thru edge and
// continue on other not_thru edges before pruning.
bool thru = not_thru_pruning_ ? (pred.not_thru_pruning() || !meta.edge->not_thru()) : false;

// Add edge label, add to the adjacency list and set edge status
Expand Down Expand Up @@ -604,6 +608,10 @@ BidirectionalAStar::GetBestPath(valhalla::Location& origin,
// on later, causing us to needlessly expand when we could have aborted sooner. However, it
// ensures that most impossible route will fail fast provided one of the locations didn't
// start from a not_thru/closed edge
// TODO(nils):
// 1. extended_search doesn't seem to do what it's documented to do; it will force both
// both directions to be eventually exhausted, no matter if the other direction
// started on a closure/not_thru
if (!extended_search_ || !pruning_disabled_at_destination_) {
return {};
}
Expand Down
7 changes: 7 additions & 0 deletions src/thor/costmatrix.cc
Expand Up @@ -567,6 +567,11 @@ void CostMatrix::BackwardSearch(const uint32_t index, GraphReader& graphreader)
edgestate.Update(pred.edgeid(), EdgeSet::kPermanent);

// Prune path if predecessor is not a through edge
// NOTE(nils): this will also be forward-compatible
// this is currently a problem when edges in not_thru
// areas are not marked, as expansion will just stop in this direction
// and continue in the other direction even though it wouldn't be able to
// find this tree inside the not_thru region
if (pred.not_thru() && pred.not_thru_pruning()) {
return;
}
Expand Down Expand Up @@ -777,6 +782,8 @@ void CostMatrix::SetSources(GraphReader& graphreader,

// Set the initial not_thru flag to false. There is an issue with not_thru
// flags on small loops. Set this to false here to override this for now.
// NOTE(nils): shouldn't not_thru_pruning be set to the opposite of the edge's not_thru flag?
// current code should also be compatible with new data
BDEdgeLabel edge_label(kInvalidLabel, edgeid, oppedge, directededge, cost, mode_, ec, d, false,
true, static_cast<bool>(flow_sources & kDefaultFlowMask),
InternalTurn::kNoTurn, -1);
Expand Down

0 comments on commit 273d917

Please sign in to comment.