From dd84a4afe59c1e2cf9f596b7ec1e9e248b48dd14 Mon Sep 17 00:00:00 2001 From: Carsten Hagelgans <52030581+carstenhagelgans@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:36:08 +0100 Subject: [PATCH 1/6] enable profilebased transfers in raptor (#56) * set clang version to 15 * added profiles * added profile dimension to footpaths/preprocessing-footpaths; added osm_type * reset preprocessing footpaths to one profile only; set profile to uint; added profile to query * fixed invalid load call; fixed wrong param order * use array instead of vectors here: profile-based footpaths * added profiles as vector; updated several functions/methods to work with profiles * changed no_profiles and profile type from int to uint8_t - no_profiles >= 1 - profile > 0 - added vscode to gitignore * Update build_footpaths.cc - removed invalid clear call - restructured two loops into one * changed uint8_t [no_]profile to uint16_t * added profile-based footpath reinitialization * bugfix - uint8_t -> uint16_t - invalid method name - missing default value (no_profiles = 1) * use resize in reinit_footpaths * fixed type in osm_type_ (osm_types_) (+) use at(idx) instead of [idx] * added profile_idx map to tt.locations * fixed clang-tidy error * set profile in query as size_t * profile_idx (type): size_t/uint16_t -> uint * set clang version - 16 * wip - added profile_idx_t - removed osm_[...] structs and types - updated footpaths_[out, in] from vector to array - added kMaxProfiles (set to 8) - added array to nigiri types * cleanup * cleanup * added profiles map to timetable struct * added location key to locations * clang-tidy fix * cleanup * cleanup * removed location key to location idx mapping; using profile_idx_T * removed footpaths from location * cleanup * improved readability timetable --------- Co-authored-by: Carsten Hagelgans --- .gitignore | 1 + .pkg.lock | 6 +++--- CMakePresets.json | 2 +- include/nigiri/loader/build_lb_graph.h | 7 ++++--- include/nigiri/location.h | 8 +------- include/nigiri/routing/query.h | 1 + include/nigiri/routing/raptor/raptor.h | 10 ++++++---- include/nigiri/routing/search.h | 4 ++-- include/nigiri/routing/start_times.h | 3 ++- include/nigiri/timetable.h | 14 ++++++------- include/nigiri/types.h | 8 +++++++- src/loader/build_footpaths.cc | 11 +++++++---- src/loader/gtfs/stop.cc | 6 ++---- src/loader/hrd/stamm/station.cc | 6 ++---- src/loader/init_finish.cc | 6 +----- src/location.cc | 27 +++----------------------- src/routing/get_fastest_direct.cc | 4 ++-- src/routing/raptor/reconstruct.cc | 13 +++++++------ src/routing/start_times.cc | 7 ++++--- test/raptor_search.cc | 8 +++++--- test/routing/start_times_test.cc | 2 +- 21 files changed, 68 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index 40e1cb39..f8458a58 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /deps /.idea /.clang-tidy +/.vscode diff --git a/.pkg.lock b/.pkg.lock index dbf52fa3..787751ce 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,5 +1,5 @@ -6084367865481574367 -cista 05ba0e6c74195bb7921e178e9f7d850407172772 +12671130249166382240 +cista 04f84b0490e0e91ead20ae6eabed5add8f243ba0 res 7d97784ba785ce8a2677ea77164040fde484fb04 date 26d109612ddb8ba331edba7619a6452667f842bb fmt c68ab4be8f3cb0e5c6eb181b3f419622e15e02bd @@ -12,5 +12,5 @@ miniz 1edbdece9d71dc65c6ff405572ee37cbdcef7af4 protobuf 297171ade5e9bd01d823ffe8b203a5443ec03f15 unordered_dense 77e91016354e6d8cba24a86c5abb807de2534c02 Catch2 47d56f28a9801911c048d011b375e5631dbb658f -utl 71144d441da35f934e14904ac1e9492925017058 +utl b81cfdccda166cef3c20dd41b4c9697b4137cea4 wyhash 1e012b57fc2227a9e583a57e2eacb3da99816d99 diff --git a/CMakePresets.json b/CMakePresets.json index 7f252a6d..715149ee 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -91,7 +91,7 @@ }, { "name": "linux-sanitizer", - "displayName": "Linux Debug", + "displayName": "Linux Sanitizer", "generator": "Ninja", "binaryDir": "${sourceDir}/build/sanitizer", "cacheVariables": { diff --git a/include/nigiri/loader/build_lb_graph.h b/include/nigiri/loader/build_lb_graph.h index 1df068f4..d189c3e5 100644 --- a/include/nigiri/loader/build_lb_graph.h +++ b/include/nigiri/loader/build_lb_graph.h @@ -4,11 +4,12 @@ #include "nigiri/logging.h" #include "nigiri/timetable.h" +#include "nigiri/types.h" namespace nigiri::loader { template -void build_lb_graph(timetable& tt) { +void build_lb_graph(timetable& tt, profile_idx_t const prf_idx = 0) { hash_map weights; auto const update_weight = [&](location_idx_t const target, @@ -26,8 +27,8 @@ void build_lb_graph(timetable& tt) { : tt.locations_.parents_[l]; auto const& footpaths = SearchDir == direction::kForward - ? tt.locations_.footpaths_in_[l] - : tt.locations_.footpaths_out_[l]; + ? tt.locations_.footpaths_in_[prf_idx][l] + : tt.locations_.footpaths_out_[prf_idx][l]; for (auto const& fp : footpaths) { auto const parent = tt.locations_.parents_[fp.target()]; auto const target = diff --git a/include/nigiri/location.h b/include/nigiri/location.h index 74568683..fc03fb5d 100644 --- a/include/nigiri/location.h +++ b/include/nigiri/location.h @@ -6,7 +6,6 @@ #include "geo/latlng.h" #include "nigiri/common/it_range.h" -#include "nigiri/footpath.h" #include "nigiri/types.h" namespace nigiri { @@ -21,25 +20,20 @@ struct location { geo::latlng pos, source_idx_t, location_type, - osm_node_id_t, location_idx_t parent, timezone_idx_t, duration_t transfer_time, - it_range::const_iterator> equivalences, - std::span footpaths_in, - std::span footpaths_out); + it_range::const_iterator> equivalences); location_idx_t l_{location_idx_t::invalid()}; std::string_view id_; std::string_view name_; geo::latlng pos_; source_idx_t src_; location_type type_; - osm_node_id_t osm_id_; location_idx_t parent_; timezone_idx_t timezone_idx_; duration_t transfer_time_; it_range::const_iterator> equivalences_; - std::span footpaths_out_, footpaths_in_; }; } // namespace nigiri diff --git a/include/nigiri/routing/query.h b/include/nigiri/routing/query.h index 63c2c715..9f8c6f75 100644 --- a/include/nigiri/routing/query.h +++ b/include/nigiri/routing/query.h @@ -44,6 +44,7 @@ struct query { unsigned min_connection_count_{0U}; bool extend_interval_earlier_{false}; bool extend_interval_later_{false}; + profile_idx_t prf_idx_{0}; }; } // namespace nigiri::routing diff --git a/include/nigiri/routing/raptor/raptor.h b/include/nigiri/routing/raptor/raptor.h index 17d577c8..ffb9aa5d 100644 --- a/include/nigiri/routing/raptor/raptor.h +++ b/include/nigiri/routing/raptor/raptor.h @@ -11,6 +11,7 @@ #include "nigiri/rt/rt_timetable.h" #include "nigiri/special_stations.h" #include "nigiri/timetable.h" +#include "nigiri/types.h" namespace nigiri::routing { @@ -99,6 +100,7 @@ struct raptor { void execute(unixtime_t const start_time, std::uint8_t const max_transfers, unixtime_t const worst_time_at_dest, + profile_idx_t const prf_idx, pareto_set& results) { auto const end_k = std::min(max_transfers, kMaxTransfers) + 1U; @@ -171,7 +173,7 @@ struct raptor { utl::fill(state_.station_mark_, false); update_transfers(k); - update_footpaths(k); + update_footpaths(k, prf_idx); update_intermodal_footpaths(k); trace_print_state_after_round(); @@ -245,15 +247,15 @@ struct raptor { } } - void update_footpaths(unsigned const k) { + void update_footpaths(unsigned const k, profile_idx_t const prf_idx) { for (auto i = 0U; i != n_locations_; ++i) { if (!state_.prev_station_mark_[i]) { continue; } auto const l_idx = location_idx_t{i}; - auto const& fps = kFwd ? tt_.locations_.footpaths_out_[l_idx] - : tt_.locations_.footpaths_in_[l_idx]; + auto const& fps = kFwd ? tt_.locations_.footpaths_out_[prf_idx][l_idx] + : tt_.locations_.footpaths_in_[prf_idx][l_idx]; for (auto const& fp : fps) { ++stats_.n_footpaths_visited_; diff --git a/include/nigiri/routing/search.h b/include/nigiri/routing/search.h index ad423f1c..992606c1 100644 --- a/include/nigiri/routing/search.h +++ b/include/nigiri/routing/search.h @@ -290,7 +290,7 @@ struct search { bool const add_ontrip) { get_starts(SearchDir, tt_, rtt_, start_interval, q_.start_, q_.start_match_mode_, q_.use_start_footpaths_, state_.starts_, - add_ontrip); + add_ontrip, q_.prf_idx_); } void remove_ontrip_results() { @@ -318,7 +318,7 @@ struct search { start_time + (kFwd ? 1 : -1) * std::min(fastest_direct_, kMaxTravelTime); algo_.execute(start_time, q_.max_transfers_, worst_time_at_dest, - state_.results_); + q_.prf_idx_, state_.results_); for (auto& j : state_.results_) { if (j.legs_.empty() && diff --git a/include/nigiri/routing/start_times.h b/include/nigiri/routing/start_times.h index 54377164..1bd47bbd 100644 --- a/include/nigiri/routing/start_times.h +++ b/include/nigiri/routing/start_times.h @@ -31,7 +31,8 @@ void get_starts(direction, location_match_mode, bool use_start_footpaths, std::vector&, - bool add_ontrip); + bool add_ontrip, + profile_idx_t); void collect_destinations(timetable const&, std::vector const& destinations, diff --git a/include/nigiri/timetable.h b/include/nigiri/timetable.h index 49772e63..e5486d30 100644 --- a/include/nigiri/timetable.h +++ b/include/nigiri/timetable.h @@ -49,7 +49,6 @@ struct timetable { preprocessing_footpaths_out_.emplace_back(); preprocessing_footpaths_in_.emplace_back(); transfer_time_.emplace_back(l.transfer_time_); - osm_ids_.emplace_back(osm_node_id_t::invalid()); parents_.emplace_back(l.parent_); } else { log(log_lvl::error, "timetable.register_location", @@ -67,7 +66,6 @@ struct timetable { assert(preprocessing_footpaths_out_.size() == next_idx + 1); assert(preprocessing_footpaths_in_.size() == next_idx + 1); assert(transfer_time_.size() == next_idx + 1); - assert(osm_ids_.size() == next_idx + 1); assert(parents_.size() == next_idx + 1); return it->second; @@ -79,13 +77,10 @@ struct timetable { coordinates_[idx], src_[idx], types_[idx], - osm_ids_[idx], parents_[idx], location_timezones_[idx], transfer_time_[idx], - it_range{equivalences_[idx]}, - std::span{footpaths_out_[idx]}, - std::span{footpaths_in_[idx]}}; + it_range{equivalences_[idx]}}; l.l_ = idx; return l; } @@ -104,14 +99,14 @@ struct timetable { vector_map src_; vector_map transfer_time_; vector_map types_; - vector_map osm_ids_; vector_map parents_; vector_map location_timezones_; mutable_fws_multimap equivalences_; mutable_fws_multimap children_; mutable_fws_multimap preprocessing_footpaths_out_; mutable_fws_multimap preprocessing_footpaths_in_; - vecvec footpaths_out_, footpaths_in_; + array, kMaxProfiles> footpaths_out_; + array, kMaxProfiles> footpaths_in_; vector_map timezones_; } locations_; @@ -442,6 +437,9 @@ struct timetable { // Lower bound graph. vecvec fwd_search_lb_graph_; vecvec bwd_search_lb_graph_; + + // profile name -> profile_idx_t + hash_map profiles_; }; } // namespace nigiri diff --git a/include/nigiri/types.h b/include/nigiri/types.h index f3fced08..81d3e7ad 100644 --- a/include/nigiri/types.h +++ b/include/nigiri/types.h @@ -9,6 +9,7 @@ #include "ankerl/cista_adapter.h" +#include "cista/containers/array.h" #include "cista/containers/bitset.h" #include "cista/containers/bitvec.h" #include "cista/containers/flat_matrix.h" @@ -59,6 +60,9 @@ using pair = cista::pair; template using vector_map = cista::raw::vector_map; +template +using array = cista::raw::array; + template using vector = cista::raw::vector; @@ -102,7 +106,6 @@ using nvec = cista::raw::nvec; using bitfield_idx_t = cista::strong; using location_idx_t = cista::strong; -using osm_node_id_t = cista::strong; using route_idx_t = cista::strong; using section_idx_t = cista::strong; using section_db_idx_t = cista::strong; @@ -117,6 +120,9 @@ using merged_trips_idx_t = using footpath_idx_t = cista::strong; using source_file_idx_t = cista::strong; +using profile_idx_t = std::uint8_t; +static constexpr auto const kMaxProfiles = profile_idx_t{8}; + using rt_trip_idx_t = cista::strong; using rt_add_trip_id_idx_t = cista::strong; diff --git a/src/loader/build_footpaths.cc b/src/loader/build_footpaths.cc index f5933078..301403a1 100644 --- a/src/loader/build_footpaths.cc +++ b/src/loader/build_footpaths.cc @@ -18,6 +18,7 @@ #include "nigiri/common/day_list.h" #include "nigiri/logging.h" #include "nigiri/rt/frun.h" +#include "nigiri/types.h" #include "utl/erase_duplicates.h" #include "utl/erase_if.h" #include "utl/pairwise.h" @@ -586,18 +587,20 @@ void add_links_to_and_between_children(timetable& tt) { } void write_footpaths(timetable& tt) { - assert(tt.locations_.footpaths_out_.empty()); - assert(tt.locations_.footpaths_in_.empty()); + assert(tt.locations_.footpaths_out_.size() == kMaxProfiles); + assert(tt.locations_.footpaths_in_.size() == kMaxProfiles); assert(tt.locations_.preprocessing_footpaths_out_.size() == tt.n_locations()); assert(tt.locations_.preprocessing_footpaths_in_.size() == tt.n_locations()); + profile_idx_t const prf_idx{0}; + for (auto i = location_idx_t{0U}; i != tt.n_locations(); ++i) { - tt.locations_.footpaths_out_.emplace_back( + tt.locations_.footpaths_out_[prf_idx].emplace_back( tt.locations_.preprocessing_footpaths_out_[i]); } for (auto i = location_idx_t{0U}; i != tt.n_locations(); ++i) { - tt.locations_.footpaths_in_.emplace_back( + tt.locations_.footpaths_in_[prf_idx].emplace_back( tt.locations_.preprocessing_footpaths_in_[i]); } diff --git a/src/loader/gtfs/stop.cc b/src/loader/gtfs/stop.cc index 7105e086..4e267667 100644 --- a/src/loader/gtfs/stop.cc +++ b/src/loader/gtfs/stop.cc @@ -242,7 +242,6 @@ locations_map read_stops(source_idx_t const src, } auto empty_idx_vec = vector{}; - auto empty_footpath_vec = vector{}; for (auto const& [id, s] : stops) { auto const is_track = s->parent_ != nullptr && !s->platform_code_.empty(); locations.emplace( @@ -250,11 +249,10 @@ locations_map read_stops(source_idx_t const src, s->location_ = tt.locations_.register_location(location{ id, is_track ? s->platform_code_ : s->name_, s->coord_, src, is_track ? location_type::kTrack : location_type::kStation, - osm_node_id_t::invalid(), location_idx_t::invalid(), + location_idx_t::invalid(), s->timezone_.empty() ? timezone_idx_t::invalid() : get_tz_idx(tt, timezones, s->timezone_), - 2_minutes, it_range{empty_idx_vec}, std::span{empty_footpath_vec}, - std::span{empty_footpath_vec}})); + 2_minutes, it_range{empty_idx_vec}})); } read_transfers(stops, transfers_file_content); diff --git a/src/loader/hrd/stamm/station.cc b/src/loader/hrd/stamm/station.cc index 178b3c9e..a01616bf 100644 --- a/src/loader/hrd/stamm/station.cc +++ b/src/loader/hrd/stamm/station.cc @@ -179,7 +179,6 @@ location_map_t parse_stations(config const& c, auto const timer = scoped_timer{"parse stations"}; auto empty_idx_vec = vector{}; - auto empty_footpath_vec = vector{}; location_map_t stations; parse_station_names(c, stations, station_names_file); @@ -194,9 +193,8 @@ location_map_t parse_stations(config const& c, auto const transfer_time = duration_t{eva_int < 1000000 ? 2 : 5}; auto const idx = tt.locations_.register_location( location{id.id_, s.name_, s.pos_, src, location_type::kStation, - osm_node_id_t::invalid(), location_idx_t::invalid(), - st.get_tz(s.id_).first, transfer_time, it_range{empty_idx_vec}, - std::span{empty_footpath_vec}, std::span{empty_footpath_vec}}); + location_idx_t::invalid(), st.get_tz(s.id_).first, + transfer_time, it_range{empty_idx_vec}}); s.idx_ = idx; } diff --git a/src/loader/init_finish.cc b/src/loader/init_finish.cc index 1c88c67d..c655624e 100644 --- a/src/loader/init_finish.cc +++ b/src/loader/init_finish.cc @@ -11,20 +11,16 @@ namespace nigiri::loader { void register_special_stations(timetable& tt) { auto empty_idx_vec = vector{}; - auto empty_footpath_vec = vector{}; for (auto const& name : special_stations_names) { tt.locations_.register_location(location{name, name, {0.0, 0.0}, source_idx_t::invalid(), location_type::kStation, - osm_node_id_t::invalid(), location_idx_t::invalid(), timezone_idx_t::invalid(), 0_minutes, - it_range{empty_idx_vec}, - std::span{empty_footpath_vec}, - std::span{empty_footpath_vec}}); + it_range{empty_idx_vec}}); } tt.location_routes_.resize(tt.n_locations()); tt.bitfields_.emplace_back(bitfield{}); // bitfield_idx 0 = 000...00 bitfield diff --git a/src/location.cc b/src/location.cc index 232daddb..4a002fc8 100644 --- a/src/location.cc +++ b/src/location.cc @@ -15,25 +15,10 @@ location::location(timetable const& tt, location_idx_t idx) pos_{tt.locations_.coordinates_[idx]}, src_{tt.locations_.src_[idx]}, type_{tt.locations_.types_[idx]}, - osm_id_{tt.locations_.osm_ids_[idx]}, parent_{tt.locations_.parents_[idx]}, timezone_idx_{tt.locations_.location_timezones_[idx]}, transfer_time_{tt.locations_.transfer_time_[idx]}, - equivalences_{tt.locations_.equivalences_[idx]}, - footpaths_out_{ - !tt.locations_.footpaths_out_.empty() - ? &(*tt.locations_.footpaths_out_[idx].begin()) - : &(*tt.locations_.preprocessing_footpaths_out_[idx].begin()), - !tt.locations_.footpaths_out_.empty() - ? tt.locations_.footpaths_out_[idx].size() - : tt.locations_.preprocessing_footpaths_out_[idx].size()}, - footpaths_in_{ - !tt.locations_.footpaths_in_.empty() - ? &(*tt.locations_.footpaths_in_[idx].begin()) - : &(*tt.locations_.preprocessing_footpaths_in_[idx].begin()), - !tt.locations_.footpaths_in_.empty() - ? tt.locations_.footpaths_in_[idx].size() - : tt.locations_.preprocessing_footpaths_in_[idx].size()} {} + equivalences_{tt.locations_.equivalences_[idx]} {} location::location( std::string_view id, @@ -41,25 +26,19 @@ location::location( geo::latlng pos, source_idx_t src, location_type type, - osm_node_id_t osm_id, location_idx_t parent, timezone_idx_t timezone, duration_t transfer_time, - it_range::const_iterator> equivalences, - std::span footpaths_in, - std::span footpaths_out) + it_range::const_iterator> equivalences) : l_{location_idx_t::invalid()}, id_{id}, name_{name}, pos_{pos}, src_{src}, type_{type}, - osm_id_{osm_id}, parent_{parent}, timezone_idx_{timezone}, transfer_time_{transfer_time}, - equivalences_{equivalences}, - footpaths_out_{footpaths_out}, - footpaths_in_{footpaths_in} {} + equivalences_{equivalences} {} } // namespace nigiri diff --git a/src/routing/get_fastest_direct.cc b/src/routing/get_fastest_direct.cc index d5051f80..fff69e45 100644 --- a/src/routing/get_fastest_direct.cc +++ b/src/routing/get_fastest_direct.cc @@ -9,8 +9,8 @@ duration_t get_fastest_direct_with_foot(timetable const& tt, auto min = duration_t{std::numeric_limits::max()}; for (auto const& start : q.start_) { auto const& footpaths = - (dir == direction::kForward ? tt.locations_.footpaths_out_ - : tt.locations_.footpaths_in_); + (dir == direction::kForward ? tt.locations_.footpaths_out_[q.prf_idx_] + : tt.locations_.footpaths_in_[q.prf_idx_]); for (auto const& fp : footpaths[start.target_]) { for (auto const& dest : q.destination_) { if (dest.target_ == fp.target()) { diff --git a/src/routing/raptor/reconstruct.cc b/src/routing/raptor/reconstruct.cc index 9f046423..1bd065b6 100644 --- a/src/routing/raptor/reconstruct.cc +++ b/src/routing/raptor/reconstruct.cc @@ -56,8 +56,8 @@ std::optional find_start_footpath(timetable const& tt, trace_rc_checking_start_fp; auto const& footpaths = - kFwd ? tt.locations_.footpaths_in_[leg_start_location] - : tt.locations_.footpaths_out_[leg_start_location]; + kFwd ? tt.locations_.footpaths_in_[q.prf_idx_][leg_start_location] + : tt.locations_.footpaths_out_[q.prf_idx_][leg_start_location]; auto const j_start_time = unix_to_delta(base, j.start_time_); auto const fp_target_time = state.round_times_[0][to_idx(leg_start_location)]; @@ -322,8 +322,9 @@ void reconstruct_journey(timetable const& tt, trace_rc_intermodal_dest_mismatch; } - for (auto const& fp : kFwd ? tt.locations_.footpaths_in_[eq] - : tt.locations_.footpaths_out_[eq]) { + for (auto const& fp : + kFwd ? tt.locations_.footpaths_in_[q.prf_idx_][eq] + : tt.locations_.footpaths_out_[q.prf_idx_][eq]) { auto fp_intermodal_dest = check_fp( k, l, curr_time, {fp.target(), dest_offset.duration_ + fp.duration()}); @@ -359,8 +360,8 @@ void reconstruct_journey(timetable const& tt, } trace_reconstruct("CHECKING FOOTPATHS OF {}\n", location{tt, l}); - auto const footpaths = - kFwd ? tt.locations_.footpaths_in_[l] : tt.locations_.footpaths_out_[l]; + auto const footpaths = kFwd ? tt.locations_.footpaths_in_[q.prf_idx_][l] + : tt.locations_.footpaths_out_[q.prf_idx_][l]; for (auto const& fp : footpaths) { auto fp_legs = check_fp(k, l, curr_time, fp); if (fp_legs.has_value()) { diff --git a/src/routing/start_times.cc b/src/routing/start_times.cc index e3233687..f07a84cc 100644 --- a/src/routing/start_times.cc +++ b/src/routing/start_times.cc @@ -215,7 +215,8 @@ void get_starts(direction const search_dir, location_match_mode const mode, bool const use_start_footpaths, std::vector& starts, - bool const add_ontrip) { + bool const add_ontrip, + profile_idx_t const prf_idx) { hash_map shortest_start; auto const update = [&](location_idx_t const l, duration_t const d) { @@ -228,8 +229,8 @@ void get_starts(direction const search_dir, for_each_meta(tt, mode, o.target(), [&](location_idx_t const l) { update(l, o.duration()); if (use_start_footpaths) { - auto const footpaths = fwd ? tt.locations_.footpaths_out_[l] - : tt.locations_.footpaths_in_[l]; + auto const footpaths = fwd ? tt.locations_.footpaths_out_[prf_idx][l] + : tt.locations_.footpaths_in_[prf_idx][l]; for (auto const& fp : footpaths) { update(fp.target(), o.duration() + fp.duration()); } diff --git a/test/raptor_search.cc b/test/raptor_search.cc index 963c7075..21a1d9d4 100644 --- a/test/raptor_search.cc +++ b/test/raptor_search.cc @@ -63,8 +63,9 @@ pareto_set raptor_search(timetable const& tt, .start_time_ = time, .start_ = {{tt.locations_.location_id_to_idx_.at({from, src}), 0_minutes, 0U}}, - .destination_ = { - {tt.locations_.location_id_to_idx_.at({to, src}), 0_minutes, 0U}}}; + .destination_ = {{tt.locations_.location_id_to_idx_.at({to, src}), + 0_minutes, 0U}}, + .prf_idx_ = 0}; return raptor_search(tt, rtt, std::move(q), search_dir); } @@ -96,7 +97,8 @@ pareto_set raptor_intermodal_search( .destination_ = std::move(destination), .min_connection_count_ = min_connection_count, .extend_interval_earlier_ = extend_interval_earlier, - .extend_interval_later_ = extend_interval_later}; + .extend_interval_later_ = extend_interval_later, + .prf_idx_ = 0}; return raptor_search(tt, rtt, std::move(q), search_dir); } diff --git a/test/routing/start_times_test.cc b/test/routing/start_times_test.cc index 5c86fb45..148ce665 100644 --- a/test/routing/start_times_test.cc +++ b/test/routing/start_times_test.cc @@ -278,7 +278,7 @@ TEST(routing, start_times) { interval{sys_days{2020_y / March / 30}, sys_days{2020_y / March / 31}}, {{A, 15_minutes, 0}, {B, 30_minutes, 0}}, - location_match_mode::kExact, false, starts, true); + location_match_mode::kExact, false, starts, true, 0); std::stringstream ss; ss << "\n"; From e1951ae66bd7f6433fc1bd4dbc24912274d0ec21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Tue, 21 Nov 2023 14:55:16 +0100 Subject: [PATCH 2/6] use new protobuf --- .pkg | 4 ++-- CMakeLists.txt | 2 +- src/rt/gtfsrt_update.cc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pkg b/.pkg index f461ce7f..d4b9acef 100644 --- a/.pkg +++ b/.pkg @@ -36,5 +36,5 @@ commit=77e91016354e6d8cba24a86c5abb807de2534c02 [protobuf] url=git@github.com:motis-project/protobuf.git - branch=master - commit=297171ade5e9bd01d823ffe8b203a5443ec03f15 + branch=main + commit=27db0ebcf49694bc55bb302b829980f1627f2a7c diff --git a/CMakeLists.txt b/CMakeLists.txt index b50599a1..f4a96923 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ add_custom_command( add_library(gtfsrt ${CMAKE_CURRENT_BINARY_DIR}/generated/gtfsrt/gtfs-realtime.pb.cc) target_compile_features(gtfsrt PUBLIC cxx_std_23) target_include_directories(gtfsrt SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/generated) -target_link_libraries(gtfsrt protobuf) +target_link_libraries(gtfsrt protobuf::libprotobuf) # --- LINT --- diff --git a/src/rt/gtfsrt_update.cc b/src/rt/gtfsrt_update.cc index 1748fffd..2d5cf12c 100644 --- a/src/rt/gtfsrt_update.cc +++ b/src/rt/gtfsrt_update.cc @@ -9,7 +9,7 @@ #include "nigiri/rt/run.h" namespace gtfsrt = transit_realtime; -namespace pb = google::protobuf; +namespace protob = google::protobuf; namespace nigiri::rt { @@ -118,7 +118,7 @@ void update_run( rt_timetable& rtt, trip_idx_t const trip, run& r, - pb::RepeatedPtrField const& stops) { + protob::RepeatedPtrField const& stops) { using std::begin; using std::end; From 472a57f24f0c2b407f7b13aa3426ab2ea30a263d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Tue, 21 Nov 2023 15:21:16 +0100 Subject: [PATCH 3/6] update protobuf --- .pkg | 2 +- .pkg.lock | 6 +++--- test/rt/gtfsrt_rt_test.cc | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.pkg b/.pkg index d4b9acef..ab1dbee0 100644 --- a/.pkg +++ b/.pkg @@ -37,4 +37,4 @@ [protobuf] url=git@github.com:motis-project/protobuf.git branch=main - commit=27db0ebcf49694bc55bb302b829980f1627f2a7c + commit=e5c9722fab303982daa17d49af1ef0c74b06c757 diff --git a/.pkg.lock b/.pkg.lock index 787751ce..03265c4b 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,15 +1,15 @@ -12671130249166382240 +1782805974414489405 cista 04f84b0490e0e91ead20ae6eabed5add8f243ba0 res 7d97784ba785ce8a2677ea77164040fde484fb04 date 26d109612ddb8ba331edba7619a6452667f842bb fmt c68ab4be8f3cb0e5c6eb181b3f419622e15e02bd -zlib 1e1dfdedddb54a2e2cb8fec3b67f925233c495aa +zlib fe8e13ffca867612951bc6baf114e5ac8b00f305 boost be5235eb2258d2ec19e32546ab767a62311d9b46 doctest 70e8f76437b76dd5e9c0a2eb9b907df190ab71a0 geo f455b76d5894bb156e3bcb1f85c3e2915820fe3a googletest 34a46558609e05865c197f0260ab36daa7cbbb6e miniz 1edbdece9d71dc65c6ff405572ee37cbdcef7af4 -protobuf 297171ade5e9bd01d823ffe8b203a5443ec03f15 +protobuf e5c9722fab303982daa17d49af1ef0c74b06c757 unordered_dense 77e91016354e6d8cba24a86c5abb807de2534c02 Catch2 47d56f28a9801911c048d011b375e5631dbb658f utl b81cfdccda166cef3c20dd41b4c9697b4137cea4 diff --git a/test/rt/gtfsrt_rt_test.cc b/test/rt/gtfsrt_rt_test.cc index 9a240c9b..13bbb7c5 100644 --- a/test/rt/gtfsrt_rt_test.cc +++ b/test/rt/gtfsrt_rt_test.cc @@ -362,7 +362,8 @@ constexpr auto const expected = R"( std::string json_to_protobuf(std::string const& json) { transit_realtime::FeedMessage msg; - google::protobuf::util::JsonStringToMessage(json, &msg); + auto const status = google::protobuf::util::JsonStringToMessage(json, &msg); + utl::verify(status.ok(), "json_to_protobuf: {}", status.message()); return msg.SerializeAsString(); } From 78b2f5cc84eff8a97b56e0cae930659c569cfd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Tue, 21 Nov 2023 15:59:07 +0100 Subject: [PATCH 4/6] tests: protobuf cleanup --- test/main.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/main.cc b/test/main.cc index f9939374..3f4cab07 100644 --- a/test/main.cc +++ b/test/main.cc @@ -1,5 +1,6 @@ #include +#include "google/protobuf/arena.h" #include "gtest/gtest.h" #include "utl/progress_tracker.h" @@ -22,5 +23,7 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); auto test_result = RUN_ALL_TESTS(); + google::protobuf::ShutdownProtobufLibrary(); + return test_result; } \ No newline at end of file From edb7a88b8f6115f985dd28bd95fef4d030f4722f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Tue, 21 Nov 2023 16:18:20 +0100 Subject: [PATCH 5/6] protobuf update (mac os cross-compiling, system header) --- .pkg | 2 +- .pkg.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pkg b/.pkg index ab1dbee0..b45e3391 100644 --- a/.pkg +++ b/.pkg @@ -37,4 +37,4 @@ [protobuf] url=git@github.com:motis-project/protobuf.git branch=main - commit=e5c9722fab303982daa17d49af1ef0c74b06c757 + commit=6b0db398b7762a6562b09352606bb667437c1d87 diff --git a/.pkg.lock b/.pkg.lock index 03265c4b..de80ba64 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,4 +1,4 @@ -1782805974414489405 +6077506664382370165 cista 04f84b0490e0e91ead20ae6eabed5add8f243ba0 res 7d97784ba785ce8a2677ea77164040fde484fb04 date 26d109612ddb8ba331edba7619a6452667f842bb @@ -9,7 +9,7 @@ doctest 70e8f76437b76dd5e9c0a2eb9b907df190ab71a0 geo f455b76d5894bb156e3bcb1f85c3e2915820fe3a googletest 34a46558609e05865c197f0260ab36daa7cbbb6e miniz 1edbdece9d71dc65c6ff405572ee37cbdcef7af4 -protobuf e5c9722fab303982daa17d49af1ef0c74b06c757 +protobuf 6b0db398b7762a6562b09352606bb667437c1d87 unordered_dense 77e91016354e6d8cba24a86c5abb807de2534c02 Catch2 47d56f28a9801911c048d011b375e5631dbb658f utl b81cfdccda166cef3c20dd41b4c9697b4137cea4 From 324480b81a33cad0362c778c37d065a6d130732e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Wed, 22 Nov 2023 18:46:36 +0100 Subject: [PATCH 6/6] update protobuf (fix x-compilation on MacOS) --- .pkg | 2 +- .pkg.lock | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pkg b/.pkg index b45e3391..075bfc12 100644 --- a/.pkg +++ b/.pkg @@ -37,4 +37,4 @@ [protobuf] url=git@github.com:motis-project/protobuf.git branch=main - commit=6b0db398b7762a6562b09352606bb667437c1d87 + commit=690e03babf0963d3da9615a2dae0891777842719 diff --git a/.pkg.lock b/.pkg.lock index de80ba64..5f181988 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,4 +1,4 @@ -6077506664382370165 +507627293430859032 cista 04f84b0490e0e91ead20ae6eabed5add8f243ba0 res 7d97784ba785ce8a2677ea77164040fde484fb04 date 26d109612ddb8ba331edba7619a6452667f842bb @@ -9,7 +9,8 @@ doctest 70e8f76437b76dd5e9c0a2eb9b907df190ab71a0 geo f455b76d5894bb156e3bcb1f85c3e2915820fe3a googletest 34a46558609e05865c197f0260ab36daa7cbbb6e miniz 1edbdece9d71dc65c6ff405572ee37cbdcef7af4 -protobuf 6b0db398b7762a6562b09352606bb667437c1d87 +abseil-cpp f2b3825f36e37fddd47c5c395096e9b1e99eca12 +protobuf 690e03babf0963d3da9615a2dae0891777842719 unordered_dense 77e91016354e6d8cba24a86c5abb807de2534c02 Catch2 47d56f28a9801911c048d011b375e5631dbb658f utl b81cfdccda166cef3c20dd41b4c9697b4137cea4