given the node order in which to visit, compute the actual route (with geometry, travel time and so on) and return the result
| 31 | // given the node order in which to visit, compute the actual route (with geometry, travel time and |
| 32 | // so on) and return the result |
| 33 | InternalRouteResult |
| 34 | TripPlugin::ComputeRoute(const RoutingAlgorithmsInterface &algorithms, |
| 35 | const std::vector<PhantomNodeCandidates> &waypoint_candidates, |
| 36 | const std::vector<NodeID> &trip, |
| 37 | const bool roundtrip) const |
| 38 | { |
| 39 | |
| 40 | // TODO make a more efficient solution that doesn't require copying all the waypoints vectors. |
| 41 | std::vector<PhantomNodeCandidates> trip_candidates; |
| 42 | std::transform(trip.begin(), |
| 43 | trip.end(), |
| 44 | std::back_inserter(trip_candidates), |
| 45 | [&](const auto &node) { return waypoint_candidates[node]; }); |
| 46 | // return back to the first node if it is a round trip |
| 47 | if (roundtrip) |
| 48 | { |
| 49 | trip_candidates.push_back(waypoint_candidates[trip.front()]); |
| 50 | // trip comes out to be something like 0 1 4 3 2 0 |
| 51 | BOOST_ASSERT(trip_candidates.size() == trip.size() + 1); |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | // trip comes out to be something like 0 1 4 3 2 |
| 56 | BOOST_ASSERT(trip_candidates.size() == trip.size()); |
| 57 | } |
| 58 | |
| 59 | auto min_route = algorithms.ShortestPathSearch(trip_candidates, {false}); |
| 60 | BOOST_ASSERT_MSG(min_route.shortest_path_weight < INVALID_EDGE_WEIGHT, "unroutable route"); |
| 61 | return min_route; |
| 62 | } |
| 63 | |
| 64 | void ManipulateTableForFSE(const std::size_t source_id, |
| 65 | const std::size_t destination_id, |