Skip to content

ABM3 Intra-Household AV Allocation and Taxi/TNC Routing Models#366

Open
dhensle wants to merge 52 commits intomainfrom
ABM3_AV_TNC_routing
Open

ABM3 Intra-Household AV Allocation and Taxi/TNC Routing Models#366
dhensle wants to merge 52 commits intomainfrom
ABM3_AV_TNC_routing

Conversation

@dhensle
Copy link
Collaborator

@dhensle dhensle commented Oct 1, 2025

Draft PR of initial code implementation of both the intra-household AV allocation and taxi/TNC routing models.

Mode detailed description of code changes forthcoming.

Copy link
Contributor

@JiaXu1024 JiaXu1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AV allocation model is not directly integrated with the main ActivitySim model pipeline. Could you update the config file to include it in the workflow?

@JiaXu1024 JiaXu1024 requested a review from Copilot January 30, 2026 23:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements two new routing models for ActivitySim's ABM3 demand modeling framework: an intra-household autonomous vehicle (AV) allocation model and a taxi/TNC fleet routing model. These models simulate vehicle dispatching and repositioning decisions for both household-owned AVs and for-hire vehicles.

Changes:

  • Adds AV routing model to allocate household AVs to driving trips and reposition vehicles between trips
  • Implements taxi/TNC routing model with trip pooling, vehicle dispatching, and refueling logic
  • Creates matrix builder utility to aggregate vehicle trips into OMX matrices for traffic assignment

Reviewed changes

Copilot reviewed 21 out of 24 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/asim/extensions/av_routing.py Core AV routing logic for matching household AVs to trips and repositioning decisions
src/asim/extensions/init.py Registers new av_routing extension module
src/asim/scripts/taxi_tnc_routing/taxi_tnc_routing.py Main taxi/TNC fleet simulation with pooling and dispatching
src/asim/scripts/taxi_tnc_routing/tnc_av_matrix_builder.py Utility to aggregate vehicle trips into OMX matrices by time period and occupancy
src/asim/scripts/taxi_tnc_routing/taxi_tnc_routing_settings.yaml Configuration file for taxi/TNC routing parameters
src/asim/scripts/taxi_tnc_routing/create_test_taxi_tnc_routing_scenario.py Test data generator for taxi/TNC routing model
src/asim/configs/resident/settings.yaml Adds av_routing model to pipeline and av_vehicle_trips to output tables
src/asim/configs/resident/settings_mp.yaml Adds av_routing to multiprocessing pipeline configuration
src/asim/configs/resident/av_routing.yaml Configuration for AV routing model specifications and coefficients
src/asim/configs/resident/av_trip_matching.csv Utility specification for AV trip matching model
src/asim/configs/resident/av_trip_matching_coefficients.csv Coefficients for AV trip matching utilities
src/asim/configs/resident/av_trip_matching_preprocessor.csv Preprocessor for AV trip matching variables
src/asim/configs/resident/av_repositioning.csv Utility specification for AV repositioning model
src/asim/configs/resident/av_repositioning_coefficients.csv Coefficients for AV repositioning utilities
src/asim/configs/resident/av_repositioning_preprocessor.csv Preprocessor for AV repositioning variables
src/asim/configs/resident/parking_location_choice_annotate_trips_preprocessor.csv Updates parking eligibility to exclude AV-serviced trips
src/asim/configs/common/constants.yaml Adds AV routing constants (max duration, parking cost)
docs/design/demand/av-routing.md Documentation for AV routing model design and configuration
docs/design/demand/taxi-tnc-routing.md Documentation for taxi/TNC routing model design and outputs
docs/design/demand/resident.md Updates resident model documentation to reference AV routing
mkdocs.yml Adds new documentation pages to navigation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dhensle dhensle marked this pull request as ready for review January 30, 2026 23:55
@dhensle
Copy link
Collaborator Author

dhensle commented Jan 30, 2026

Were the demand matrix files produced using the updated model as well? i.e. TNCVehicleTrips_[time_period].omx and emptyAVTrips.omx

Yes, these are being created by the tnc_av_matrix_builder.py file. (It was not yet committed when you made this comment, but is there now!)

@dhensle
Copy link
Collaborator Author

dhensle commented Jan 30, 2026

@JiaXu1024 I believe I have addressed all of the comments here. We are doing a final integration test and will of course fix any issues that arise from that, but I believe this is functionally complete!

@JiaXu1024 JiaXu1024 requested a review from aber-sandag February 3, 2026 22:40
@JiaXu1024 JiaXu1024 requested review from bhargavasana and removed request for aber-sandag February 12, 2026 22:20


At this point, all tours are generated, scheduled, have a primary destination, and a selected tour mode. The next set of models fills in details about the tours - number of intermediate stops, location of each stop, the departure time of each stop, and the mode of each trip on the tour. Finally, the parking location of each auto trip to the central business district (CBD) is determined.
At this point, all tours are generated, scheduled, have a primary destination, and a selected tour mode. The next set of models fills in details about the tours - number of intermediate stops, location of each stop, the departure time of each stop, and the mode of each trip on the tour. For households that own autonomous vehicles, an additional [AV Routing Model](av-routing.md) is run after the resident model completes. This model simulates how household AVs are dispatched to serve household members' trips throughout the day. Finally, the parking location of each auto trip to the central business district (CBD) is determined.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor correction, AV routing model does not run after resident model completes. It runs between trips mode choice and parking location choice models.

util_next1_rel,reliability vehicle location to next trip 1 origin,"@df.v_to_trip_orig1_rel * 14 / np.maximum(0.1, df.v_to_trip_orig1_dist)",,,,coef_ivt,,
util_next1_auto_cost,auto operating cost from vehicle location to next trip 1 origin,@(df.v_to_trip_orig1_dist * costPerMile * autoCostPerMileFactorAV) + df.v_to_trip_orig1_toll,,,,coef_cost,,
# service next trip util 2,,,,,,,,
util_next_trip_available,Unavailable if no next trip,next_trip_id_2 == -1,,,,,coef_unavailable,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on line 28, should this be "util_next_trip_available_2"?

Description,Target,Expression
next trip start time,next_depart,df['trip_id'].map(trips.groupby('tour_id')['depart'].shift(-1).to_dict())
trip duration,duration_hrs,"np.where(next_depart.isna(), 0, next_depart - df.depart) / 2"
duration benefit,duration_benefit,"np.where((duration_hrs < 1.5) & (duration_hrs > 0), 60 - (60/1.5 * duration_hrs), 0)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duration_benefit term is not being used in av_repositioning.csv, maybe drop?

Effective parking cost,parkingCost,"np.where(is_joint+is_indiv*(1-reimbursePurpose), parkingCostBeforeReimb,_parkingCost)"
Parking cost is 0 if going home,parkingCost,"np.where(df.destination == df.home_zone_id, 0, parkingCost)"
# These following two are from AutonomousVehicleAllocationChoice.xls,,
Maximim benefit for keeping car close (min),AV_maxBenefit,60
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to define these here because they are in configs/common/constants.yaml?

Maximum duration for keeping car close (hrs),AV_maxDuration,1.5
Slope of benefit calculation,slope, (-1)*(AV_maxBenefit / AV_maxDuration)
# below taken from parametersByYear.csv,,
,RemoteParkingCostPerHour,0.81
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

util_time_go_to_parking,Remote- Need car soon,"@np.where(df.duration_hrs < df.AV_maxDuration, (-1)*(df.AV_maxBenefit + (df.duration_hrs*df.slope)), 0)",,coef_ivt,,,,
util_remote_cost,Remote park - Cost of parking until departure,duration_hrs * RemoteParkingCostPerHour * 100,,coef_cost,,,,
util_remote_ivt,in vehicle time to remote parking location,@v_to_parking_skim['SOV_TR_H_TIME'],,coef_ivt,,,,
util_remote_rel,reliability vehicle location to remote parking location,"@v_to_parking_skim['SOV_TR_H_REL'] * 14 / np.maximum(0.1, v_to_parking_skim['SOV_TR_H_DIST'])",,coef_ivt,,,,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is the factor 14 we are multiplying reliability by?

@@ -0,0 +1,4 @@
Description,Target,Expression
next trip start time,next_depart,df['trip_id'].map(trips.groupby('tour_id')['depart'].shift(-1).to_dict())
trip duration,duration_hrs,"np.where(next_depart.isna(), 0, next_depart - df.depart) * 2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not match with calculation in av_repositioning_preprocessor, the number of bin should be divided by 2 and not multiplied by 2?

Description,Target,Expression
next trip start time,next_depart,df['trip_id'].map(trips.groupby('tour_id')['depart'].shift(-1).to_dict())
trip duration,duration_hrs,"np.where(next_depart.isna(), 0, next_depart - df.depart) * 2"
duration benefit,duration_benefit,"np.where((duration_hrs < 1.5) & (duration_hrs > 0), 60 - (60/1.5 * duration_hrs), 0)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to get AV_maxduration and AV_maxbenefit from configs/common/constants.yaml here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants