[go: nahoru, domu]

Skip to content
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

Add transfer time settings for routing (with LB) #114

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix start footpaths
  • Loading branch information
pablohoch committed Jun 19, 2024
commit ef738b70fb8ebefbcc9eb49c362317babe0b0faf
2 changes: 1 addition & 1 deletion include/nigiri/routing/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ struct search {
state_.starts_.reserve(500'000);
get_starts(SearchDir, tt_, rtt_, start_interval, q_.start_,
q_.start_match_mode_, q_.use_start_footpaths_, state_.starts_,
add_ontrip, q_.prf_idx_);
add_ontrip, q_.prf_idx_, q_.transfer_time_settings_);
std::sort(
begin(state_.starts_), end(state_.starts_),
[&](start const& a, start const& b) { return kFwd ? b < a : a < b; });
Expand Down
3 changes: 2 additions & 1 deletion include/nigiri/routing/start_times.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void get_starts(direction,
bool use_start_footpaths,
std::vector<start>&,
bool add_ontrip,
profile_idx_t);
profile_idx_t,
transfer_time_settings const&);

void collect_destinations(timetable const&,
std::vector<offset> const& destinations,
Expand Down
6 changes: 4 additions & 2 deletions src/routing/start_times.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ void get_starts(direction const search_dir,
bool const use_start_footpaths,
std::vector<start>& starts,
bool const add_ontrip,
profile_idx_t const prf_idx) {
profile_idx_t const prf_idx,
transfer_time_settings const& tts) {
hash_map<location_idx_t, duration_t> shortest_start;

auto const update = [&](location_idx_t const l, duration_t const d) {
Expand All @@ -209,7 +210,8 @@ void get_starts(direction const search_dir,
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());
update(fp.target(),
o.duration() + adjusted_transfer_time(tts, fp.duration()));
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/routing/start_times_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ TEST(routing, start_times) {
interval<unixtime_t>{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, 0);
location_match_mode::kExact, false, starts, true, 0, {});
std::sort(begin(starts), end(starts),
[](auto&& a, auto&& b) { return a > b; });
starts.erase(std::unique(begin(starts), end(starts)), end(starts));
Expand Down