Skip to content

Commit da5f08f

Browse files
Simplify base calculation
1 parent ddfee3b commit da5f08f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/routing/one_to_all.cc

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ namespace nigiri::routing {
1515

1616
constexpr auto const kVias = via_offset_t{0U};
1717

18-
day_idx_t make_base(timetable const& tt, start_time_t start_time) {
19-
auto const midpoint =
20-
std::visit(utl::overloaded{
21-
[](interval<unixtime_t> const start_interval) {
22-
return start_interval.from_ +
23-
((start_interval.to_ - start_interval.from_) / 2);
24-
},
25-
[](unixtime_t const t) { return t; }},
26-
start_time);
18+
day_idx_t make_base(timetable const& tt, unixtime_t start_time) {
19+
// Use day of midpoint for search interval
2720
return day_idx_t{std::chrono::duration_cast<date::days>(
28-
std::chrono::round<std::chrono::days>(midpoint) -
21+
std::chrono::round<std::chrono::days>(start_time) -
2922
tt.internal_interval().from_)
3023
.count()};
3124
}
@@ -70,7 +63,7 @@ raptor_state one_to_all(timetable const& tt,
7063
auto is_via = std::array<bitvec, kMaxVias>{};
7164
auto dist_to_dest = std::vector<std::uint16_t>{};
7265
auto lb = std::vector<std::uint16_t>(tt.n_locations(), 0U);
73-
auto const base = make_base(tt, q.start_time_);
66+
auto const base = make_base(tt, start_time);
7467
auto const is_wheelchair = true;
7568

7669
auto r = raptor<SearchDir, true, kVias, search_mode::kOneToAll>{

0 commit comments

Comments
 (0)