Skip to content

Commit

Permalink
interval extension: maximum 2 days
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Nov 3, 2024
1 parent a983abd commit fe8663e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/nigiri/routing/interval_estimate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ struct interval_estimator {
[](interval<unixtime_t> iut) { return iut; }},
q.start_time_);

auto const interval =
q.fastest_direct_ ? std::chrono::days{1} : std::chrono::days{2};
data_type_max_interval_ = {
std::chrono::round<std::chrono::days>(
start_itv.from_ + ((start_itv.to_ - start_itv.from_) / 2)) -
kMaxSearchIntervalSize,
interval,
std::chrono::round<std::chrono::days>(
start_itv.from_ + ((start_itv.to_ - start_itv.from_) / 2)) +
kMaxSearchIntervalSize};
interval};
}

interval<unixtime_t> initial(interval<unixtime_t> const& itv) const {
Expand Down
2 changes: 2 additions & 0 deletions include/nigiri/routing/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct offset {
struct td_offset {
friend bool operator==(td_offset const&, td_offset const&) = default;

duration_t duration() const noexcept { return duration_; }

unixtime_t valid_from_;
duration_t duration_;
transport_mode_id_t transport_mode_id_;
Expand Down
17 changes: 17 additions & 0 deletions include/nigiri/routing/raptor/raptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
namespace nigiri::routing {

struct raptor_stats {
std::map<std::string, std::uint64_t> to_map() const {
return {
{"n_routing_time", n_routing_time_},
{"n_footpaths_visited", n_footpaths_visited_},
{"n_routes_visited", n_routes_visited_},
{"n_earliest_trip_calls", n_earliest_trip_calls_},
{"n_earliest_arrival_updated_by_route",
n_earliest_arrival_updated_by_route_},
{"n_earliest_arrival_updated_by_footpath",
n_earliest_arrival_updated_by_footpath_},
{"fp_update_prevented_by_lower_bound",
fp_update_prevented_by_lower_bound_},
{"route_update_prevented_by_lower_bound",
route_update_prevented_by_lower_bound_},
};
}

std::uint64_t n_routing_time_{0ULL};
std::uint64_t n_footpaths_visited_{0ULL};
std::uint64_t n_routes_visited_{0ULL};
Expand Down
9 changes: 9 additions & 0 deletions include/nigiri/routing/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ struct search_state {
};

struct search_stats {
std::map<std::string, std::uint64_t> to_map() const {
return {
{"lb_time", lb_time_},
{"fastest_direct", fastest_direct_},
{"interval_extensions", interval_extensions_},
{"execute_time", execute_time_.count()},
};
}

std::uint64_t lb_time_{0ULL};
std::uint64_t fastest_direct_{0ULL};
std::uint64_t interval_extensions_{0ULL};
Expand Down

0 comments on commit fe8663e

Please sign in to comment.