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

Odm taxi #729

Merged
merged 175 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 163 commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
6ec1ad7
fiber executor
felixguendling Nov 29, 2024
bfb6ea7
wip
felixguendling Nov 29, 2024
ad78902
try fix msvc build
felixguendling Nov 29, 2024
7e5d2dd
try compile x86 on macos-13
felixguendling Nov 29, 2024
17772a1
wip
felixguendling Nov 29, 2024
8438534
wip
felixguendling Nov 29, 2024
06f6d7c
wip (not working)
felixguendling Dec 1, 2024
f771d61
wip
felixguendling Dec 1, 2024
fb37605
wip
felixguendling Dec 1, 2024
c246309
introduce priorities
felixguendling Dec 2, 2024
f6bf5ff
add mode specific timing stats + lookup timings
felixguendling Dec 2, 2024
0550118
fiber_props: virtual dtor
felixguendling Dec 2, 2024
ff24f28
try fix msvc prefetch instruction include
felixguendling Dec 2, 2024
6087eca
adds ODM mode
mority Dec 10, 2024
b6b61da
wip
mority Dec 11, 2024
b957365
boost::fiber uses std::aligned_storage which is deprecated in c++23
mority Dec 11, 2024
bd277fc
wip
mority Dec 11, 2024
c7453f1
wip
mority Dec 11, 2024
e82aed0
wip
mority Dec 12, 2024
edbac51
wip
mority Dec 12, 2024
024c6fa
Merge branch 'master' of github.com:motis-project/motis into fiber
felixguendling Dec 12, 2024
2ed1741
wip
felixguendling Dec 12, 2024
b9f206b
wip
mority Dec 13, 2024
82f34ee
wip
mority Dec 13, 2024
941ef86
wip
felixguendling Dec 13, 2024
5263cec
wip
mority Dec 13, 2024
ec4c285
wip
mority Dec 13, 2024
79c20de
wip
mority Dec 13, 2024
c956ac5
wip
mority Dec 16, 2024
13f21b7
wip
mority Dec 16, 2024
413df1e
wip
mority Dec 16, 2024
02b7f5e
wip
mority Dec 17, 2024
61ba394
wip
mority Dec 17, 2024
9e334f1
wip
mority Dec 17, 2024
eee5fb7
wip
mority Dec 17, 2024
bff5a4d
wip
mority Dec 18, 2024
695e39e
wip
mority Dec 18, 2024
9c8aae2
wip
mority Dec 18, 2024
a33847a
wip
mority Dec 18, 2024
89b5515
adds ODM mode
mority Dec 10, 2024
1f1fc39
wip
mority Dec 11, 2024
a70e623
boost::fiber uses std::aligned_storage which is deprecated in c++23
mority Dec 11, 2024
ec017dc
wip
mority Dec 11, 2024
79098f0
wip
mority Dec 11, 2024
79ef2ad
wip
mority Dec 12, 2024
c4a9549
wip
mority Dec 12, 2024
753d834
wip
mority Dec 13, 2024
8c627cc
wip
mority Dec 13, 2024
ba78d67
wip
mority Dec 13, 2024
633abf0
wip
mority Dec 13, 2024
e6a7e96
wip
mority Dec 13, 2024
6836e0e
wip
mority Dec 16, 2024
f180c17
wip
mority Dec 16, 2024
0fdb43b
wip
mority Dec 16, 2024
c297690
wip
mority Dec 17, 2024
107d332
wip
mority Dec 17, 2024
b2aa22e
wip
mority Dec 17, 2024
307312a
wip
mority Dec 17, 2024
5bbb30b
wip
mority Dec 18, 2024
bd9519c
wip
mority Dec 18, 2024
e06ca16
wip
mority Dec 18, 2024
5551dfc
wip
mority Dec 18, 2024
53c0fbb
wip
mority Dec 19, 2024
934dced
Merge remote-tracking branch 'origin/odm-taxi' into odm-taxi
mority Dec 19, 2024
8f5a212
wip
mority Dec 19, 2024
3946769
wip
mority Dec 19, 2024
d21da02
wip
mority Dec 19, 2024
8524ea2
wip
mority Dec 19, 2024
616e9fb
wip
mority Dec 20, 2024
ab14d05
wip
mority Dec 20, 2024
9c370b7
wip
mority Dec 20, 2024
758641d
wip
mority Dec 23, 2024
e456c72
wip
mority Dec 23, 2024
1b21eef
wip
mority Dec 23, 2024
135d3bb
wip
mority Dec 23, 2024
db98b7e
wip
mority Dec 23, 2024
a4f91f4
wip
mority Dec 23, 2024
f05ed0d
wip
mority Dec 23, 2024
5f37f30
wip
mority Dec 24, 2024
a069e76
wip
mority Dec 27, 2024
b4dd5db
wip
mority Dec 27, 2024
19689e9
wip
mority Dec 30, 2024
c5625bf
wip
mority Dec 30, 2024
6fd792d
wip
mority Dec 30, 2024
b966d08
wip
mority Dec 30, 2024
05ffaec
wip
mority Dec 30, 2024
dd5e42b
wip
mority Jan 2, 2025
ba7ced4
wip
mority Jan 2, 2025
f5357a2
Merge branch 'master' into odm-taxi
mority Jan 2, 2025
3e970ca
wip
mority Jan 3, 2025
1b05aa5
wip
mority Jan 3, 2025
1a03575
wip
mority Jan 3, 2025
f79e639
wip
mority Jan 6, 2025
9356f91
wip
mority Jan 6, 2025
889aaaa
wip
mority Jan 6, 2025
2d80573
wip
mority Jan 7, 2025
d4eea63
wip
mority Jan 7, 2025
79ba000
wip
mority Jan 7, 2025
c375f8e
wip
mority Jan 7, 2025
aa620b6
wip
mority Jan 8, 2025
82e2748
wip
mority Jan 8, 2025
d8e781f
wip
mority Jan 8, 2025
8a0c0fb
wip
mority Jan 9, 2025
591a950
wip
mority Jan 9, 2025
d4fe58d
wip
mority Jan 9, 2025
f5b1da5
wip
mority Jan 10, 2025
eb9e251
wip
mority Jan 10, 2025
e89f891
wip
mority Jan 10, 2025
647823b
wip
mority Jan 13, 2025
c6c3ff9
nigiri version
mority Jan 14, 2025
75dc467
prima time format
mority Jan 14, 2025
ae78ca9
prima time format
mority Jan 15, 2025
aeb57ee
prima time format
mority Jan 15, 2025
9217c85
prima time format
mority Jan 15, 2025
e6af75a
wip
mority Jan 16, 2025
831bb08
wip
mority Jan 16, 2025
dbee166
prima time format
mority Jan 17, 2025
431b0ce
wip
mority Jan 17, 2025
59b7db6
smaller dest interval
mority Jan 22, 2025
fd18558
use direct duration as additional upper boundary for offset length
mority Jan 23, 2025
603ec9b
hardcap for number of ODM events used in blacklisting
mority Jan 23, 2025
ac5dba8
wip
mority Jan 24, 2025
cf25d29
wip
mority Jan 24, 2025
b7cd8d9
wip
mority Jan 28, 2025
124d934
fix encoding of rides as td_offsets
mority Jan 30, 2025
5262976
adds ODM search profile
mority Jan 30, 2025
f692d93
Merge branch 'master' into odm-taxi
mority Jan 30, 2025
f4d0e3a
fixes after merge
mority Jan 30, 2025
88dca53
rm calibration code
mority Jan 30, 2025
eb08504
rm calibration code
mority Jan 30, 2025
09dbf98
adjust mixer to current resistance model
mority Jan 30, 2025
4cf7921
rm calibration code
mority Jan 30, 2025
68bf01a
wip
mority Jan 31, 2025
e556425
wip
mority Jan 31, 2025
6ab2463
wip
mority Jan 31, 2025
aaa7857
wip
mority Feb 3, 2025
af9e3f6
wip
mority Feb 3, 2025
8fd55b6
wip
mority Feb 4, 2025
11903f8
wip
mority Feb 4, 2025
44f32d5
adds transfer note for ODM legs, hides ODM transfer buffer footpaths
mority Feb 4, 2025
944239b
wip
mority Feb 5, 2025
503f53f
wip
mority Feb 6, 2025
d92189a
wip
mority Feb 6, 2025
31619e9
prettier
mority Feb 6, 2025
86f6994
rm append_range
mority Feb 6, 2025
01d055d
fix date range
mority Feb 6, 2025
8e3e335
rm kEmpty
mority Feb 6, 2025
4755bb5
wip
felixguendling Feb 6, 2025
cef19df
remove unused include
felixguendling Feb 6, 2025
0ecad0a
adjusts beta parameter for Klein-Radisch -> Niesky connection set
mority Feb 7, 2025
2769a74
wip
felixguendling Feb 7, 2025
dca509f
Merge branch 'odm-taxi' of github.com:mority/motis into odm-taxi
felixguendling Feb 7, 2025
7891abc
fix msvc
felixguendling Feb 7, 2025
6efdc15
emplace_back -> push_back
felixguendling Feb 7, 2025
9b913ee
wip
felixguendling Feb 7, 2025
099e6bf
wip
felixguendling Feb 7, 2025
a329dd4
wip
felixguendling Feb 7, 2025
9f793ac
wip
felixguendling Feb 7, 2025
da41e03
wip
felixguendling Feb 7, 2025
ce880eb
wip
felixguendling Feb 7, 2025
b35e9c9
wip
felixguendling Feb 7, 2025
91273e8
update net
felixguendling Feb 7, 2025
4583e04
wip
felixguendling Feb 7, 2025
f3938bb
wip
felixguendling Feb 7, 2025
77cd9d0
wip
felixguendling Feb 7, 2025
e8cac4a
wip
felixguendling Feb 7, 2025
ab3e74e
wip
felixguendling Feb 7, 2025
50473d5
wip
felixguendling Feb 7, 2025
c9ddce7
wip
felixguendling Feb 7, 2025
5f0e710
wip
felixguendling Feb 7, 2025
5f98ba5
wip
felixguendling Feb 7, 2025
a85a6e0
wip
felixguendling Feb 7, 2025
64dfa2e
wip
felixguendling Feb 7, 2025
8714232
wip
felixguendling Feb 7, 2025
2ccdffe
wip
felixguendling Feb 7, 2025
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
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ jobs:
buildcache-${{ matrix.config.preset }}-

- name: Dependencies Cache
uses: actions/cache@v4
uses: actions/cache/restore@v4
id: restore-deps
with:
path: ${{ github.workspace }}/deps
key: deps-${{ hashFiles('.pkg') }}
Expand Down Expand Up @@ -220,6 +221,13 @@ jobs:
path: ${{ github.workspace }}/.buildcache
key: ${{ steps.restore-buildcache.outputs.cache-primary-key }}

- name: Save deps cache
if: always()
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/deps
key: ${{ steps.restore-deps.outputs.cache-primary-key }}

# ==== DISTRIBUTION ====
- name: Create Distribution
run: |
Expand Down
4 changes: 2 additions & 2 deletions .pkg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
[net]
[email protected]:motis-project/net.git
branch=master
commit=6a457f5eaa077078fcac4153c5a178657737eee8
commit=43423bb08c636c9dd91e4d58b5b557c6d2f25efe
[openapi-cpp]
[email protected]:triptix-tech/openapi-cpp.git
branch=master
Expand All @@ -45,7 +45,7 @@
[boost]
[email protected]:motis-project/boost.git
branch=boost-1.86.0
commit=930f38eb0365ceb7853273e03da4d9e7787abfb9
commit=4a9aca6cb8af75be6e58f28c09cc7e39f61e6173
[tg]
[email protected]:triptix-tech/tg.git
branch=main
Expand Down
6 changes: 3 additions & 3 deletions .pkg.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
16722610972019258869
3612327711671169474
cista 6362f3ad8c3133a0abf64e5d8c9ea3e21f531ee8
zlib-ng 68ab3e2d80253ec5dc3c83691d9ff70477b32cd3
boost 930f38eb0365ceb7853273e03da4d9e7787abfb9
boost 4a9aca6cb8af75be6e58f28c09cc7e39f61e6173
googletest 7b64fca6ea0833628d6f86255a81424365f7cc0c
lz4 c4765545ebb14b0a56c663e21923166923f8280e
mimalloc e2f4fe647e8aff4603a7d5119b8639fd1a47c8a6
Expand All @@ -13,7 +13,7 @@ res b759b93316afeb529b6cb5b2548b24c41e382fb0
date ce88cc33b5551f66655614eeebb7c5b7189025fb
yaml-cpp 1d8ca1f35eb3a9c9142462b28282a848e5d29a91
openapi-cpp 688d45bd96addb26eaccc5d264761030e5ef43f9
net 6a457f5eaa077078fcac4153c5a178657737eee8
net 43423bb08c636c9dd91e4d58b5b557c6d2f25efe
PEGTL 1c1aa6e650e4d26f10fa398f148ec0cdc5f0808d
oh d21c30f40e52a83d6dc09bcffd0067598b5ec069
doctest 70e8f76437b76dd5e9c0a2eb9b907df190ab71a0
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)

project(motis)
project(motis LANGUAGES C CXX ASM)

set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

Expand Down Expand Up @@ -81,6 +81,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-Wno-shadow-uncaptured-local
-Wno-documentation-deprecated-sync
-Wno-float-equal
-Wno-deprecated-declarations
-Werror)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(motis-compile-options -Wall -Wextra -Werror -Wno-unknown-pragmas)
Expand Down Expand Up @@ -113,6 +114,7 @@ target_link_libraries(motislib
osr
adr
boost-json
Boost::fiber
motis-api
reflectcpp
web-server
Expand Down
2 changes: 2 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/macos-x86_64-release",
"cacheVariables": {
"BOOST_CONTEXT_ABI": "sysv",
"BOOST_CONTEXT_ARCHITECTURE": "x86_64",
"CMAKE_OSX_ARCHITECTURES": "x86_64",
"CMAKE_CXX_FLAGS": "-stdlib=libc++",
"CMAKE_BUILD_TYPE": "Release"
Expand Down
14 changes: 14 additions & 0 deletions include/motis/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct config {

bool requires_rt_timetable_updates() const;
bool has_gbfs_feeds() const;
bool has_odm_providers() const;

bool operator==(config const&) const = default;

Expand Down Expand Up @@ -121,6 +122,19 @@ struct config {
};
std::optional<gbfs> gbfs_{};

struct odm {
bool operator==(odm const&) const = default;

struct provider {
bool operator==(provider const&) const = default;
std::optional<std::string> blacklist_url_;
std::string whitelist_url_;
std::string booking_url_;
};
std::map<std::string, provider> providers_{};
};
std::optional<odm> odm_{};

bool street_routing_{false};
bool osr_footpath_{false};
bool elevators_{false};
Expand Down
30 changes: 30 additions & 0 deletions include/motis/endpoints/routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,48 @@
#include <utility>
#include <vector>

#include "boost/thread/tss.hpp"

#include "osr/location.h"
#include "osr/types.h"

#include "nigiri/routing/clasz_mask.h"
#include "nigiri/routing/raptor/raptor_state.h"
#include "nigiri/routing/raptor_search.h"

#include "motis-api/motis-api.h"
#include "motis/elevators/elevators.h"
#include "motis/fwd.h"
#include "motis/match_platforms.h"
#include "motis/place.h"

namespace motis::ep {

// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern boost::thread_specific_ptr<nigiri::routing::search_state> search_state;

// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern boost::thread_specific_ptr<nigiri::routing::raptor_state> raptor_state;

// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern boost::thread_specific_ptr<osr::bitvec<osr::node_idx_t>> blocked;

using stats_map_t = std::map<std::string, std::uint64_t>;

bool is_intermodal(place_t const&);

nigiri::routing::location_match_mode get_match_mode(place_t const&);

std::vector<nigiri::routing::offset> station_start(nigiri::location_idx_t);

std::vector<nigiri::routing::via_stop> get_via_stops(
nigiri::timetable const&,
tag_lookup const&,
std::optional<std::vector<std::string>> const& vias,
std::vector<std::int64_t> const& times);

void remove_slower_than_fastest_direct(nigiri::routing::query&);

struct routing {
api::plan_response operator()(boost::urls::url_view const&) const;

Expand Down
5 changes: 5 additions & 0 deletions include/motis/http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ struct http_client {
boost::asio::awaitable<http_response> get(
boost::urls::url url, std::map<std::string, std::string> headers);

boost::asio::awaitable<http_response> post(
boost::urls::url,
std::map<std::string, std::string> headers,
std::string body);

void set_proxy(boost::urls::url const&);

hash_map<connection_key, std::shared_ptr<connection>> connections_;
Expand Down
6 changes: 6 additions & 0 deletions include/motis/http_req.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ boost::asio::awaitable<http_response> http_GET(
std::map<std::string, std::string> const& headers,
std::chrono::seconds timeout);

boost::asio::awaitable<http_response> http_POST(
boost::urls::url,
std::map<std::string, std::string> const& headers,
std::string const& body,
std::chrono::seconds timeout);

std::string get_http_body(http_response const&);

} // namespace motis
10 changes: 10 additions & 0 deletions include/motis/odm/equal_journeys.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "nigiri/routing/journey.h"

namespace motis::odm {

bool operator==(nigiri::routing::journey const&,
felixguendling marked this conversation as resolved.
Show resolved Hide resolved
nigiri::routing::journey const&);

} // namespace motis::odm
92 changes: 92 additions & 0 deletions include/motis/odm/meta_router.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#pragma once

#include <optional>
#include <variant>
#include <vector>

#include "osr/location.h"

#include "nigiri/types.h"

#include "motis-api/motis-api.h"

#include "motis/endpoints/routing.h"
#include "motis/fwd.h"
#include "motis/gbfs/routing_data.h"
#include "motis/place.h"

namespace nigiri {
struct timetable;
struct rt_timetable;
} // namespace nigiri

namespace nigiri::routing {
struct query;
struct journey;
} // namespace nigiri::routing

namespace motis::odm {

struct meta_router {
meta_router(ep::routing const&,
api::plan_params const&,
std::vector<api::ModeEnum> const& pre_transit_modes,
std::vector<api::ModeEnum> const& post_transit_modes,
std::vector<api::ModeEnum> const& direct_modes,
std::variant<osr::location, tt_location> const& from,
std::variant<osr::location, tt_location> const& to,
api::Place const& from_p,
api::Place const& to_p,
nigiri::routing::query const& start_time,
std::vector<api::Itinerary>& direct,
nigiri::duration_t fastest_direct_,
bool odm_pre_transit,
bool odm_post_transit,
bool odm_direct);

api::plan_response run();

private:
void init_prima(nigiri::interval<nigiri::unixtime_t> const& from_intvl,
nigiri::interval<nigiri::unixtime_t> const& to_intvl);
void extract_direct();

ep::routing const& r_;
api::plan_params const& query_;
std::vector<api::ModeEnum> const& pre_transit_modes_;
std::vector<api::ModeEnum> const& post_transit_modes_;
std::vector<api::ModeEnum> const& direct_modes_;
std::variant<osr::location, tt_location> const& from_;
std::variant<osr::location, tt_location> const& to_;
api::Place const& from_place_;
api::Place const& to_place_;
nigiri::routing::query const& start_time_;
std::vector<api::Itinerary>& direct_;
nigiri::duration_t fastest_direct_;
bool odm_pre_transit_;
bool odm_post_transit_;
bool odm_direct_;

nigiri::timetable const* tt_;
std::shared_ptr<rt> const rt_;
nigiri::rt_timetable const* rtt_;
motis::elevators const* e_;
gbfs::gbfs_routing_data gbfs_rd_;
std::variant<osr::location, tt_location> const& start_;
std::variant<osr::location, tt_location> const& dest_;
std::vector<api::ModeEnum> start_modes_;
std::vector<api::ModeEnum> dest_modes_;

std::optional<std::vector<api::RentalFormFactorEnum>> const&
start_form_factors_;
std::optional<std::vector<api::RentalFormFactorEnum>> const&
dest_form_factors_;
std::optional<std::vector<api::RentalPropulsionTypeEnum>> const&
start_propulsion_types_;
std::optional<std::vector<api::RentalPropulsionTypeEnum>> const&
dest_propulsion_types_;
std::optional<std::vector<std::string>> const& start_rental_providers_;
std::optional<std::vector<std::string>> const& dest_rental_providers_;
};

} // namespace motis::odm
35 changes: 35 additions & 0 deletions include/motis/odm/mixer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "nigiri/routing/journey.h"
#include "nigiri/routing/pareto_set.h"
#include "nigiri/types.h"

#include "motis-api/motis-api.h"

namespace motis::odm {

struct cost_threshold {
std::int32_t threshold_;
std::int32_t cost_;
};

std::int32_t tally(std::int32_t, std::vector<cost_threshold> const&);

struct mixer {
void mix(nigiri::pareto_set<nigiri::routing::journey> const& pt_journeys,
std::vector<nigiri::routing::journey>& odm_journeys) const;
std::int32_t transfer_cost(nigiri::routing::journey const&) const;
void cost_domination(
nigiri::pareto_set<nigiri::routing::journey> const& pt_journeys,
std::vector<nigiri::routing::journey>& odm_journeys) const;
void productivity_domination(
std::vector<nigiri::routing::journey>& odm_journeys) const;

double alpha_;
double beta_;
std::vector<cost_threshold> walk_cost_;
std::vector<cost_threshold> taxi_cost_;
std::vector<cost_threshold> transfer_cost_;
};

} // namespace motis::odm
20 changes: 20 additions & 0 deletions include/motis/odm/odm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#include "nigiri/routing/journey.h"
#include "nigiri/types.h"

#include "motis-api/motis-api.h"

namespace motis::odm {

static constexpr auto const kODMTransferBuffer = nigiri::duration_t{5};
constexpr auto const kODM =
static_cast<nigiri::transport_mode_id_t>(api::ModeEnum::ODM);
constexpr auto const kWalk =
static_cast<nigiri::transport_mode_id_t>(api::ModeEnum::WALK);

enum which_mile { kFirstMile, kLastMile };

bool is_odm_leg(nigiri::routing::journey::leg const&);

} // namespace motis::odm
Loading
Loading