Skip to content

Commit

Permalink
Add transfer time settings (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohoch authored Aug 14, 2024
1 parent 7653556 commit ea0d02a
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pkg
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
[nigiri]
[email protected]:motis-project/nigiri.git
branch=master
commit=9f12ac87cccfd3aaed292835a9bf6281f1605045
commit=14dd54b7a25240c55586fc1c8e89aafab1f6b0d4
[osr]
[email protected]:motis-project/osr.git
branch=master
Expand Down
6 changes: 3 additions & 3 deletions .pkg.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
15093259680503631013
13514127881199516696
cista a25863155854a0a5555f7ce24b90d325780c0dd4
zlib fe8e13ffca867612951bc6baf114e5ac8b00f305
boost 60cae66449fa3c9599b2b7d3d5d44c65301ed3a3
Expand All @@ -12,7 +12,7 @@ res 7d97784ba785ce8a2677ea77164040fde484fb04
date 646ba5e2e76636d9e65aaa3cf32e3e3a43defa2c
flatbuffers a2028f13ae6aafe855010b43a0c93f86e04d9717
doctest 70e8f76437b76dd5e9c0a2eb9b907df190ab71a0
geo ee76668f0f0454e4acd3c769e00c6868620e3490
geo 7eb4283bde68fc4fbb0bac2fd1d4fa28cba814af
utf8proc 779b780da3b99d123133eb99707b65c7e4324cc8
guess cecba85dbd6796c92a7f9c4e274849bb6ef03494
lmdb 9bd01f14f549d8202413c4cd5f49b066b0a22b66
Expand All @@ -24,7 +24,7 @@ abseil-cpp ba5240842d352b4b67a32092453a2fe5fe53a62e
protobuf d8136b9c6a62db6ce09900ecdeb82bb793096cbd
unordered_dense c11595a7743d20622637584bddf77243d72ae152
wyhash 1e012b57fc2227a9e583a57e2eacb3da99816d99
nigiri 9f12ac87cccfd3aaed292835a9bf6281f1605045
nigiri 14dd54b7a25240c55586fc1c8e89aafab1f6b0d4
expat 636c9861e8e7c119f3626d1e6c260603ab624516
libosmium d5cc2a02d997c2b464d37d37c3a75cd9efa23dc4
protozero 8c9f3fa97c2cfdceef86d0b61818ae98e9328f29
Expand Down
16 changes: 15 additions & 1 deletion docs/api/schemas/motis/intermodal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,24 @@ IntermodalRoutingRequest:
description: |
The maximum number of transfers allowed per journey.
If set to `-1`, the internal default value is used.
If set to `-1` (the default value if not specified), the internal
default value is used.
bike_transport:
description: |
Whether only journeys where bike transport is allowed should be considered.
If set to `true`, only trips where bike transport is allowed can be
used.
min_transfer_time:
description: |
The minimum transfer time in minutes.
Set to `0` (the default value if not specified) to use the default
transfer times from the timetable.
transfer_time_factor:
description: |
Multiply all transfer times by this factor. Must be >= 1.0.
The minimum transfer time is not multiplied by this factor.
Set to `1.0` (the default value if not specified) to use the default
transfer times from the timetable.
16 changes: 15 additions & 1 deletion docs/api/schemas/motis/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,27 @@ RoutingRequest:
description: |
The maximum number of transfers allowed per journey.
If set to `-1`, the internal default value is used.
If set to `-1` (the default value if not specified), the internal
default value is used.
bike_transport:
description: |
Whether only journeys where bike transport is allowed should be considered.
If set to `true`, only trips where bike transport is allowed can be
used.
min_transfer_time:
description: |
The minimum transfer time in minutes.
Set to `0` (the default value if not specified) to use the default
transfer times from the timetable.
transfer_time_factor:
description: |
Multiply all transfer times by this factor. Must be >= 1.0.
The minimum transfer time is not multiplied by this factor.
Set to `1.0` (the default value if not specified) to use the default
transfer times from the timetable.
RoutingResponse:
description: TODO
fields:
Expand Down
3 changes: 2 additions & 1 deletion modules/intermodal/src/intermodal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ msg_ptr intermodal::route(msg_ptr const& msg) {
? 0
: mc.CreateVector(req->allowed_claszes()->Data(),
req->allowed_claszes()->size()),
req->max_transfers(), req->bike_transport())
req->max_transfers(), req->bike_transport(),
req->min_transfer_time(), req->transfer_time_factor())
.Union(),
router);

Expand Down
7 changes: 6 additions & 1 deletion modules/nigiri/src/routing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,12 @@ motis::module::msg_ptr route(tag_lookup const& tags, n::timetable const& tt,
.extend_interval_later_ = extend_interval_later,
.prf_idx_ = prf_idx,
.allowed_claszes_ = to_clasz_mask(req->allowed_claszes()),
.require_bike_transport_ = req->bike_transport()};
.require_bike_transport_ = req->bike_transport(),
.transfer_time_settings_ = n::routing::transfer_time_settings{
.default_ = req->min_transfer_time() <= 0 &&
req->transfer_time_factor() == 1.0F,
.min_transfer_time_ = n::duration_t{req->min_transfer_time()},
.factor_ = req->transfer_time_factor()}};

utl::verify(!q.start_.empty(), "no start edges");
utl::verify(!q.destination_.empty(), "no destination edges");
Expand Down
2 changes: 2 additions & 0 deletions protocol/intermodal/IntermodalRoutingRequest.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,6 @@ table IntermodalRoutingRequest {
allowed_claszes: [ubyte] (optional);
max_transfers: int = -1 (optional); // -1 = use default value
bike_transport: bool = false (optional);
min_transfer_time: int = 0 (optional); // minutes
transfer_time_factor: float = 1.0 (optional);
}
2 changes: 2 additions & 0 deletions protocol/routing/RoutingRequest.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,6 @@ table RoutingRequest {
allowed_claszes: [ubyte] (optional);
max_transfers: int = -1 (optional); // -1 = use default value
bike_transport: bool = false (optional);
min_transfer_time: int = 0 (optional); // minutes
transfer_time_factor: float = 1.0 (optional);
}

0 comments on commit ea0d02a

Please sign in to comment.