Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9b3967b
Move the existing routing code to `routing/road`, and create a new fo…
ChenhaoDing Nov 19, 2025
106bce9
Add Raptor CPP Router
ChenhaoDing Dec 11, 2025
799e14e
feat(raptor): introduce RaptorRouterCpp and optimize journey calculation
ChenhaoDing Dec 11, 2025
5a24eaf
Stop tracking .DS_Store file
ChenhaoDing Dec 12, 2025
48ed8b6
Stop tracking src/routing/pt/cpp_raptor_router/PyPTRouter.cpp file
ChenhaoDing Dec 12, 2025
089116b
Update gitignore file
ChenhaoDing Dec 12, 2025
8f57732
Add PT Offer class
ChenhaoDing Dec 12, 2025
e27f2a5
Add Intermodal Offer class
ChenhaoDing Dec 12, 2025
832529b
Add BasicIntermodalRequest class
ChenhaoDing Dec 15, 2025
aab0f94
Add PTControl class to simulate PT operator behaviors
ChenhaoDing Dec 15, 2025
48339d5
feat: introduce RAPTOR-based PT router and TPCS PTBroker
ChenhaoDing Dec 17, 2025
daa5ab1
Standardize fixed-line transportation service naming to 'pt' and upda…
ChenhaoDing Dec 18, 2025
71d7c4c
Remove a duplicated global value and add a new self attribute to Basi…
ChenhaoDing Jan 5, 2026
2b3bed0
Bug fix
ChenhaoDing Jan 15, 2026
1d17444
feat: new PTBroker step 1
ChenhaoDing Jan 26, 2026
0052995
feat: New PTBroker step 1
ChenhaoDing Jan 26, 2026
05e40e7
1. update pt preprocessing directory path;
ChenhaoDing Jan 28, 2026
58f88b8
update the readme file, add compile instruction for the PT router
ChenhaoDing Jan 29, 2026
d06909e
Move to win
ChenhaoDing Jan 30, 2026
fc0a9ee
Basic Collaborative Coordination
ChenhaoDing Jan 30, 2026
27b8673
Enable customizable wait time for last mile AMoD pickups
ChenhaoDing Jan 30, 2026
9fc7680
Update initialization mehtod of PTBroker
ChenhaoDing Jan 30, 2026
31b3e52
- Bugfix: PTBroker
ChenhaoDing Feb 2, 2026
546e60a
Estimation-based Integration
ChenhaoDing Feb 3, 2026
2b38409
PTBrokerEI
ChenhaoDing Feb 3, 2026
f6b6eeb
Add automatic cancellation mechanism when FM AMoD is late for PT conn…
ChenhaoDing Feb 4, 2026
eacf014
Add PAYG
ChenhaoDing Feb 5, 2026
918b55d
Modify the logic of implementing MaaS estimated detour time factor
ChenhaoDing Feb 5, 2026
9ae9e78
Fix bugs
ChenhaoDing Feb 13, 2026
de1c55d
add pixi support
ChenhaoDing Feb 23, 2026
f2370ab
Merge branch 'chenhao/ptbroker_to_be_merged' of github.com:TUM-VT/Fle…
ChenhaoDing Feb 23, 2026
395ae28
remove pixi support
ChenhaoDing Feb 23, 2026
ccf2d67
Add strategy doc comments to PTBroker modules and update changelog
ChenhaoDing Mar 9, 2026
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
Binary file removed .DS_Store
Binary file not shown.
27 changes: 19 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ data/networks/*
data/networks/example_network/ff/*
data/networks/example_network/ch_graph/*
data/networks/example_network/base/*.graph
data/pubtrans/*
!data/pubtrans/route_193
data/pt/*
!data/pt/route_193
!data/pt/example_network
data/vehicles/*
!data/vehicles/default_vehtype.csv
!data/vehicles/low_range_vehtype.csv
Expand All @@ -35,7 +36,8 @@ data/zones/*
studies/*
!studies/example_study
studies/example_study/results/*
!studies/module_tests/*
!studies/module_tests
studies/module_tests/benchmark_comparison.csv
studies/module_tests/results/*
!studies/module_tests/results/benchmark.csv
!studies/manhattan_case_study
Expand All @@ -46,15 +48,18 @@ studies/chicago_case_study/results/*
studies/munich_case_study/results/*

# system dependent C++ Router files
src/routing/cpp_router/*.pyd
src/routing/cpp_router/build/*
src/routing/cpp_router/PyNetwork.cpp
src/routing/extractors/cache/*
src/routing/road/cpp_router/*.pyd
src/routing/road/cpp_router/build/*
src/routing/road/cpp_router/PyNetwork.cpp
src/routing/road/extractors/cache/*

src/routing/pt/cpp_raptor_router/PyPTRouter.cpp
src/routing/pt/cpp_raptor_router/build/*

# IDE-related files
*.idea
.vscode/*
src/routing/cpp_router/.vs/*
src/routing/road/cpp_router/.vs/*

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -186,3 +191,9 @@ dmypy.json

# Pyre type checker
.pyre/

# MacOS
.DS_Store

# GTFS preprocessing file
!src/preprocessing/pt/PTRouterGTFSPreperation.ipynb
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,17 @@ conda activate fleetpy

### 2️⃣ Install C++ Router (Recommended)

For improved routing efficiency, compile the C++ router:
For improved road network routing efficiency, compile the C++ road router:

```bash
cd FleetPy/src/routing/cpp_router
cd FleetPy/src/routing/road/cpp_router
python setup.py build_ext --inplace
```

To enable public transport routing, compile the C++ RAPTOR router:

```bash
cd FleetPy/src/routing/pt/cpp_raptor_router
python setup.py build_ext --inplace
```

Expand Down
85 changes: 85 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,91 @@

All notable changes to this project will be documented in this file.

## [1.1.0] - 2025-12-18

Key update:
1. Refactored routing file structure: road-related routing modules are moved to the `road` subdirectory, and PT-related routing modules are moved to the `pt` subdirectory.
2. Introduced a C++ routing module based on the RAPTOR algorithm for querying the fastest PT travel plans between two stations.
3. Introduced the PTControl module to simulate PT operator behavior, such as recording offer information and dynamically updating GTFS files.
4. Introduced three PTBroker strategy variants to simulate different levels of MaaS–DRT coordination for intermodal requests: Plan-As-You-Go (PTBrokerPAYG), Estimation-based Integration (PTBrokerEI), and Collaborative Coordination (PTBroker).
5. Introduced subrequest ID coding rules for intermodal scenarios, using unique integers to classify legs and `{parent_rid}_{subtrip_id}` to define new subrequest IDs.

### Added
- cpp_raptor_router: C++ implementation of the PT router based on the RAPTOR algorithm

- RaptorRouterCpp: Python entry point for the PT router, responsible for activating the cpp_raptor_router instance and regularizing PT requests

- PTControlBase & PTControlBasic: Modules to simulate PT operator behavior, such as recording offer information and dynamically updating GTFS files

- PTOffer: Class for recording PT offer information

- IntermodalOffer: Class for recording offer information for intermodal requests

- BasicIntermodalRequest: Class to simulate travel behavior of travelers with intermodal requests

- example_100_intermodal.csv: Intermodal demand based on example_100.csv, containing 25 monomodal, 25 first-mile, 25 last-mile, and 25 first-last-mile requests

- example_100_intermodal_lmwt30.csv: Variant of the intermodal demand file with a 30-second last-mile wait time constraint

- example_gtfs: Public transport design based on example_network

- PTBrokerBasic: Base class providing shared infrastructure for intermodal request handling across all PTBroker variants (FM, LM, FLM sub-request creation, offer assembly, booking confirmation)

- PTBroker (Collaborative Coordination): Simulates a future scenario with tight MaaS–DRT integration. DRT provides a predicted FM dropoff time; PT feeds back the user's expected station waiting time, which MaaS uses to dynamically adjust the DRT dropoff deadline, giving DRT more pooling flexibility while guaranteeing PT connection. LM DRT wait time can also be constrained to minimize destination wait.

- PTBrokerEI (Estimation-based Integration): Simulates current MaaS platforms with limited real-time DRT communication. FM dropoff time is estimated using `broker_maas_detour_time_factor` rather than obtained from an actual DRT offer. A conservative factor ensures PT is caught but increases travel time; an optimistic factor risks missing PT.

- PTBrokerPAYG (Plan-As-You-Go): Simulates the absence of a MaaS platform. Each leg is planned only after the previous one completes (FM DRT → PT → LM DRT). Trips may be interrupted if a subsequent leg is unavailable.

- intermodal_evaluation: Evaluation methods designed for intermodal scenarios

- example_study & module_tests: Added intermodal scenario example experiments

- globals: Added `RQ_MODAL_STATE`, `RQ_SUB_TRIP_ID`, and `PAYG_TRIP_STATE` enums for intermodal sub-request classification; added global variable names for PT (`G_PT_*`), intermodal offers (`G_IM_*`), and broker configuration (`G_BROKER_*`, including `G_BROKER_MAAS_DETOUR_TIME_FACTOR`, `G_BROKER_TRANSFER_SEARCH_METHOD`, `G_BROKER_ALWAYS_QUERY_PT`, `G_IM_LM_WAIT_TIME`)

- init_modules: Added initialization code for PTControl and PTBroker modules

- FleetSimulationBase: Added code to load PTControl and PTBroker modules

- PlanRequest: Added `set_new_dropoff_time_constraint` method to update the passenger's latest drop-off time constraint

- Demand: Added `create_sub_requests` method to establish sub-requests for corresponding legs of intermodal requests

- RequestBase: Added `modal state` attribute (default: monomodal) and `get_modal_state` method

- PTRouterGTFSPreperation: Jupyter notebook for cleaning and formatting raw GTFS data for RaptorRouterCpp

### Changed
- BrokerBase & BrokerBasic: `collect_offers` method now accepts an input variable `sim_time` (int, default: None)

- ImmediateDecisionsSimulation: Added `sim_time` input variable when calling `self.broker.collect_offers`

- RequestBase: Updated `create_SubTripRequest` method to create intermodal sub-requests

- insertion: `insertion_with_heuristics` and `reservation_insertion_with_heuristics` methods added `excluded_vid` input (list of vehicle IDs that should not be considered for assignment)

- RollingHorizon: `return_immediate_reservation_offer` method added `excluded_vid` input

- PoolingIRSOnly: `user_request` method added optional `max_wait_time` parameter (used for LM leg of intermodal requests); tracks `flm_excluded_vid` to exclude the FM vehicle from LM assignment in FLM requests

- Vehicles: `assign_vehicle_plan` method now uses `rid_struct` to obtain request information

- FleetSimulationBase: Modified public transportation module loading code; modified `evaluate` method to use `G_EVAL_METHOD` to specify standard result evaluation (default: standard_evaluation)

- gitignore: Ignored specific C++ Router files

### Deprecated
- globals: Traveler modal state global variables are no longer used (G_RQ_STATE_MONOMODAL, G_RQ_STATE_FIRSTMILE, G_RQ_STATE_LASTMILE, G_RQ_STATE_FIRSTLASTMILE)

### Removed
- globals: Traveler modal state global variable names

### Fixed
- RollingHorizon: Correctly retrieve `vid` and `veh_obj` in `user_cancels_request` method

- FleetSimulationBase: In `update_sim_state_fleets`, ensured `rid_struct` is the actual key of the dictionary returned by `veh_obj.update_veh_state`



## [1.0.0] - 2025-04-DD

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
rq_time,start,end,request_id,is_multimodal,modal_state_value,transfer_station_ids,max_transfers
194,2966,2977,0,1,2,s15,1
217,2966,2973,1,0,0,-1,1
301,2976,2966,2,1,1,s15,1
388,2982,2980,3,0,0,-1,1
397,2977,2968,4,1,3,s15;s1,1
679,2966,2985,5,1,2,s15,1
890,2993,2988,6,0,0,-1,1
896,2966,2973,7,1,2,s15,1
933,2977,2986,8,1,3,s15;s1,1
959,2976,2982,9,0,0,-1,1
983,2977,2966,10,1,1,s15,1
1085,2966,2981,11,1,2,s15,1
1092,2992,2980,12,0,0,-1,1
1185,2987,2984,13,0,0,-1,1
1204,2966,2981,14,1,2,s15,1
1320,2993,2980,15,1,1,s1,1
1449,2977,2967,16,1,3,s15;s1,1
1511,2984,2966,17,1,1,s15,1
1514,2989,2977,18,1,3,s1;s15,1
1558,2989,2975,19,1,3,s1;s15,1
1587,2981,2979,20,0,0,-1,1
1659,2978,2966,21,1,1,s15,1
1668,2966,2982,22,1,2,s15,1
1681,2967,2980,23,1,1,s1,1
1725,2966,2977,24,1,2,s15,1
1735,2990,2982,25,1,3,s1;s15,1
2045,2980,2993,26,1,2,s1,1
2045,2969,2993,27,0,0,-1,1
2127,2973,2966,28,1,1,s15,1
2198,2966,2976,29,1,2,s15,1
2309,2986,2966,30,1,1,s15,1
2383,2989,2978,31,1,3,s1;s15,1
2416,2981,2969,32,1,3,s15;s1,1
2494,2992,2980,33,1,1,s1,1
2540,2980,2970,34,1,2,s1,1
2626,2990,2988,35,1,3,s1;s15,1
2727,2972,2985,36,0,0,-1,1
2803,2970,2972,37,0,0,-1,1
2881,2993,2980,38,1,1,s1,1
2912,2992,2982,39,1,3,s1;s15,1
2947,2990,2981,40,0,0,-1,1
3008,2966,2982,41,1,2,s15,1
3064,2986,2970,42,0,0,-1,1
3088,2973,2966,43,1,1,s15,1
3109,2967,2981,44,1,3,s1;s15,1
3303,2980,2971,45,1,2,s1,1
3373,2976,2987,46,0,0,-1,1
3437,2971,2966,47,1,1,s15,1
3616,2966,2982,48,1,2,s15,1
3637,2983,2966,49,1,1,s15,1
3725,2974,2966,50,1,1,s15,1
3846,2966,2988,51,1,2,s15,1
3855,2969,2979,52,1,3,s1;s15,1
3881,2980,2990,53,1,2,s1,1
4260,2980,2992,54,1,2,s1,1
4325,2972,2991,55,0,0,-1,1
4341,2979,2969,56,1,3,s15;s1,1
4394,2983,2967,57,1,3,s15;s1,1
4464,2981,2971,58,0,0,-1,1
4476,2966,2981,59,1,2,s15,1
4564,2980,2969,60,1,2,s1,1
4621,2979,2968,61,1,3,s15;s1,1
4642,2991,2980,62,1,1,s1,1
4722,2989,2967,63,0,0,-1,1
4877,2978,2992,64,1,3,s15;s1,1
4944,2980,2972,65,1,2,s1,1
4960,2979,2966,66,1,1,s15,1
4984,2987,2966,67,1,1,s15,1
4997,2980,2992,68,1,2,s1,1
5118,2968,2980,69,1,1,s1,1
5177,2993,2977,70,1,3,s1;s15,1
5237,2985,2967,71,1,3,s15;s1,1
5401,2967,2981,72,0,0,-1,1
5459,2980,2969,73,1,2,s1,1
5470,2969,2979,74,0,0,-1,1
5486,2984,2993,75,1,3,s15;s1,1
5505,2984,2992,76,1,3,s15;s1,1
5531,2986,2966,77,1,1,s15,1
5541,2970,2981,78,1,3,s1;s15,1
5563,2978,2975,79,0,0,-1,1
5571,2980,2993,80,1,2,s1,1
5580,2984,2969,81,0,0,-1,1
5622,2970,2980,82,1,1,s1,1
5637,2975,2976,83,0,0,-1,1
5701,2966,2987,84,1,2,s15,1
5726,2971,2978,85,0,0,-1,1
5788,2969,2982,86,1,3,s1;s15,1
6062,2978,2993,87,1,3,s15;s1,1
6252,2966,2982,88,1,2,s15,1
6437,2992,2980,89,0,0,-1,1
6580,2982,2966,90,1,1,s15,1
6617,2973,2982,91,0,0,-1,1
6648,2973,2966,92,1,1,s15,1
6685,2967,2974,93,1,3,s1;s15,1
6707,2968,2991,94,0,0,-1,1
6850,2966,2987,95,1,2,s15,1
6886,2991,2980,96,1,1,s1,1
6910,2983,2993,97,1,3,s15;s1,1
6944,2976,2966,98,1,1,s15,1
7152,2988,2980,99,1,1,s1,1
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
rq_time,start,end,request_id,is_multimodal,modal_state_value,transfer_station_ids,max_transfers,im_lastmile_wait_time
194,2966,2977,0,1,2,s15,1,30.0
217,2966,2973,1,0,0,-1,1,
301,2976,2966,2,1,1,s15,1,
388,2982,2980,3,0,0,-1,1,
397,2977,2968,4,1,3,s15;s1,1,30.0
679,2966,2985,5,1,2,s15,1,30.0
890,2993,2988,6,0,0,-1,1,
896,2966,2973,7,1,2,s15,1,30.0
933,2977,2986,8,1,3,s15;s1,1,30.0
959,2976,2982,9,0,0,-1,1,
983,2977,2966,10,1,1,s15,1,
1085,2966,2981,11,1,2,s15,1,30.0
1092,2992,2980,12,0,0,-1,1,
1185,2987,2984,13,0,0,-1,1,
1204,2966,2981,14,1,2,s15,1,30.0
1320,2993,2980,15,1,1,s1,1,
1449,2977,2967,16,1,3,s15;s1,1,30.0
1511,2984,2966,17,1,1,s15,1,
1514,2989,2977,18,1,3,s1;s15,1,30.0
1558,2989,2975,19,1,3,s1;s15,1,30.0
1587,2981,2979,20,0,0,-1,1,
1659,2978,2966,21,1,1,s15,1,
1668,2966,2982,22,1,2,s15,1,30.0
1681,2967,2980,23,1,1,s1,1,
1725,2966,2977,24,1,2,s15,1,30.0
1735,2990,2982,25,1,3,s1;s15,1,30.0
2045,2980,2993,26,1,2,s1,1,30.0
2045,2969,2993,27,0,0,-1,1,
2127,2973,2966,28,1,1,s15,1,
2198,2966,2976,29,1,2,s15,1,30.0
2309,2986,2966,30,1,1,s15,1,
2383,2989,2978,31,1,3,s1;s15,1,30.0
2416,2981,2969,32,1,3,s15;s1,1,30.0
2494,2992,2980,33,1,1,s1,1,
2540,2980,2970,34,1,2,s1,1,30.0
2626,2990,2988,35,1,3,s1;s15,1,30.0
2727,2972,2985,36,0,0,-1,1,
2803,2970,2972,37,0,0,-1,1,
2881,2993,2980,38,1,1,s1,1,
2912,2992,2982,39,1,3,s1;s15,1,30.0
2947,2990,2981,40,0,0,-1,1,
3008,2966,2982,41,1,2,s15,1,30.0
3064,2986,2970,42,0,0,-1,1,
3088,2973,2966,43,1,1,s15,1,
3109,2967,2981,44,1,3,s1;s15,1,30.0
3303,2980,2971,45,1,2,s1,1,30.0
3373,2976,2987,46,0,0,-1,1,
3437,2971,2966,47,1,1,s15,1,
3616,2966,2982,48,1,2,s15,1,30.0
3637,2983,2966,49,1,1,s15,1,
3725,2974,2966,50,1,1,s15,1,
3846,2966,2988,51,1,2,s15,1,30.0
3855,2969,2979,52,1,3,s1;s15,1,30.0
3881,2980,2990,53,1,2,s1,1,30.0
4260,2980,2992,54,1,2,s1,1,30.0
4325,2972,2991,55,0,0,-1,1,
4341,2979,2969,56,1,3,s15;s1,1,30.0
4394,2983,2967,57,1,3,s15;s1,1,30.0
4464,2981,2971,58,0,0,-1,1,
4476,2966,2981,59,1,2,s15,1,30.0
4564,2980,2969,60,1,2,s1,1,30.0
4621,2979,2968,61,1,3,s15;s1,1,30.0
4642,2991,2980,62,1,1,s1,1,
4722,2989,2967,63,0,0,-1,1,
4877,2978,2992,64,1,3,s15;s1,1,30.0
4944,2980,2972,65,1,2,s1,1,30.0
4960,2979,2966,66,1,1,s15,1,
4984,2987,2966,67,1,1,s15,1,
4997,2980,2992,68,1,2,s1,1,30.0
5118,2968,2980,69,1,1,s1,1,
5177,2993,2977,70,1,3,s1;s15,1,30.0
5237,2985,2967,71,1,3,s15;s1,1,30.0
5401,2967,2981,72,0,0,-1,1,
5459,2980,2969,73,1,2,s1,1,30.0
5470,2969,2979,74,0,0,-1,1,
5486,2984,2993,75,1,3,s15;s1,1,30.0
5505,2984,2992,76,1,3,s15;s1,1,30.0
5531,2986,2966,77,1,1,s15,1,
5541,2970,2981,78,1,3,s1;s15,1,30.0
5563,2978,2975,79,0,0,-1,1,
5571,2980,2993,80,1,2,s1,1,30.0
5580,2984,2969,81,0,0,-1,1,
5622,2970,2980,82,1,1,s1,1,
5637,2975,2976,83,0,0,-1,1,
5701,2966,2987,84,1,2,s15,1,30.0
5726,2971,2978,85,0,0,-1,1,
5788,2969,2982,86,1,3,s1;s15,1,30.0
6062,2978,2993,87,1,3,s15;s1,1,30.0
6252,2966,2982,88,1,2,s15,1,30.0
6437,2992,2980,89,0,0,-1,1,
6580,2982,2966,90,1,1,s15,1,
6617,2973,2982,91,0,0,-1,1,
6648,2973,2966,92,1,1,s15,1,
6685,2967,2974,93,1,3,s1;s15,1,30.0
6707,2968,2991,94,0,0,-1,1,
6850,2966,2987,95,1,2,s15,1,30.0
6886,2991,2980,96,1,1,s1,1,
6910,2983,2993,97,1,3,s15;s1,1,30.0
6944,2976,2966,98,1,1,s15,1,
7152,2988,2980,99,1,1,s1,1,
Empty file modified data/networks/osm_route_MVG_road/base/crs.info
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions data/pt/example_network/example_gtfs/matched/agency_fp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
agency_id,agency_name
pt,FleetPy PT Operator
2 changes: 2 additions & 0 deletions data/pt/example_network/example_gtfs/matched/calendar_fp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
0,1,1,1,1,1,1,1,20000101,20991231
3 changes: 3 additions & 0 deletions data/pt/example_network/example_gtfs/matched/routes_fp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
route_id,route_short_name,route_desc
196,196,Bus
U5,U5,U-Bahn
Loading