diff --git a/src/mjolnir/graphenhancer.cc b/src/mjolnir/graphenhancer.cc index e310e1d70d..97070dd6a7 100644 --- a/src/mjolnir/graphenhancer.cc +++ b/src/mjolnir/graphenhancer.cc @@ -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++; diff --git a/src/thor/bidirectional_astar.cc b/src/thor/bidirectional_astar.cc index 99ea3417b6..efd559e73d 100644 --- a/src/thor/bidirectional_astar.cc +++ b/src/thor/bidirectional_astar.cc @@ -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 @@ -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 {}; } diff --git a/src/thor/costmatrix.cc b/src/thor/costmatrix.cc index 134eaace52..4f53e6c2cf 100644 --- a/src/thor/costmatrix.cc +++ b/src/thor/costmatrix.cc @@ -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; } @@ -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(flow_sources & kDefaultFlowMask), InternalTurn::kNoTurn, -1);